This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Usage: | |
| # Manual (nbshell): Just copy-paste the entire contents of this file into `nautobot-server nbshell` and run it. Make sure to restart sessions between runs or risk not including your latest code changes. | |
| # Automated (invoke): nautobot-server shell --interface=python --command "exec(open('/source/nbshell_view_tests.py').read())" | |
| # | |
| # Pre-requisites: | |
| # 1. Standard Nautobot patterns must be followed for things like pyproject.toml configuration, view definitions, and filterset definitions. This is necessary for the test to be able to discover the models and views to test. | |
| # 2. User created with permissions to access all views (e.g. superuser) must be used to run the test and be the first user in the database (or you can modify the code to select a different user). | |
| # | |
| # Tests two things for every model in the app defined by pyproject.toml: | |
| # 1. Every sortable table column returns HTTP 200 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function myFunction() { | |
| //---------The following variables are meant to be changed to meet your specfic needs--------- | |
| const daysOut = 14; | |
| const regex = /([\(|\[])?\S+?\-\d+([\)|\]])?($|\s+)/; | |
| const regexCapture = /(?:[\(|\[])?(\S+?\-\d+)([\)|\]])?($|\s+)/g; | |
| // An example, modify as required | |
| const customerDomain = { | |
| "coke.com": "COKE-10", | |
| "pepsi.com": "PEP-89", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| password: !vault | | |
| $ANSIBLE_VAULT;1.1;AES256 | |
| 61363732366665663763656465386566336161383135323766393034393765643734363431333930 | |
| 6664373330623639363864393230373435663737343639340a393561363334343833653566666562 | |
| 31363939383762316132363039353739613534356438303765316662373133626333343330633462 | |
| 3464633761363437340a346338623164393166373162356337623066653931656334313862363739 | |
| 3432 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function myFunction() { | |
| //---------The following variables are meant to be changed to meet your specfic needs--------- | |
| const domainSuffix = 'networktocode.com'; | |
| const daysOut = 90; | |
| const msgBody = "This invite has been declined automatically, as it was received from a networktocode.com email domain, without a subject line ending with a charge code.\n\n"; | |
| // Regex searches for XXX-DD, (XXX-DD), and [XXX-DD] with optional whitespace at the end | |
| const regex = /([\(|\[])?\S+?\-\d+([\)|\]])?($|\s+)/; | |
| //---------The code below should only be required to be edited if you wish to change the functionality of the process--------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| from datetime import datetime | |
| from nautobot.extras.jobs import Job, MultiObjectVar, BooleanVar | |
| from nautobot.extras.models import Tag | |
| from nautobot.dcim.models import Device, DeviceRole, DeviceType, Manufacturer, Site, Platform, Region, Rack, RackGroup | |
| from nautobot.tenancy.models import Tenant, TenantGroup | |
| from nornir import InitNornir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| root@c4cc2b4306fd:/tmp/data-manipulation# ansible-playbook -i localhost, data-manipulation.yml | |
| PLAY [SHOW THE VARIOUS WAYS TO RESTRUCTURE DATA] *********************************************************************************************************************************************************** | |
| TASK [100 - SET FACT TO NORMALIZE DATA] ******************************************************************************************************************************************************************** | |
| ok: [localhost] => (item={u'destination_address': u'aabb.cc00.6000', u'vlan': u'153', u'type': u'DYNAMIC', u'destination_port': u'Fa1/0/36'}) | |
| ok: [localhost] => (item={u'destination_address': u'ca03.3efb.0000', u'vlan': u'100', u'type': u'DYNAMIC', u'destination_port': u'Fa1/0/36'}) | |
| ok: [localhost] => (item={u'destination_address': u'f44d.3063.34f3', u'vlan': u'22', u'type': u'DYNAMIC', u'destination_port': u'Fa1/0/35'}) | |
| ok: [localhost] => (item={u'destination_address': u'2c6b.f553.9d80', u'vlan': u'254', u'type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy.orm import Session, relationship, backref, sessionmaker | |
| from sqlalchemy import create_engine, Column, String, Integer, ForeignKey, Boolean | |
| from sqlalchemy import MetaData | |
| from sqlalchemy.orm import create_session | |
| from sqlalchemy.ext.automap import automap_base | |
| import random, string | |
| def randomword(length): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ansible2.4) ken@ken-VirtualBox:~/github/cookbook$ cat host_vars/matrix-1.yml | |
| --- | |
| interfaces: | |
| - name: Ethernet1/0 | |
| connected_device: R1 | |
| connected_device_port: Ethernet1/0 | |
| type: dynamic_dot1q | |
| - name: Ethernet1/1 | |
| connected_device: R1 |