RESTCONF / NETCONF ON CISCO 3850
This is a blog from a CCIE to share our knowledge to help others that have the same issues
Tuesday, August 27, 2019
Labels:
Cisco 3850,
NETCONF,
Network Automation,
RESTCONF
AZURE PS CLI
Create resource group
Create an Azure resource group with New-AzResourceGroup. A resource group is a logical container into which Azure resources are deployed and managed.
New-AzResourceGroup -Name myResourceGroup -Location EastUS
Create virtual machine
Create a VM with New-AzVM. Provide names for each of the resources and the
New-AzVM
cmdlet creates if they don't already exist.
When prompted, provide a username and password to be used as the sign-in credentials for the VM:
New-AzVm `
-ResourceGroupName "myResourceGroup" `
-Name "myVM" `
-Location "East US" `
-VirtualNetworkName "myVnet" `
-SubnetName "mySubnet" `
-SecurityGroupName "myNetworkSecurityGroup" `
-PublicIpAddressName "myPublicIpAddress" `
-OpenPorts 80,3389
Connect to virtual machine
After the deployment has completed, RDP to the VM. To see your VM in action, the IIS web server is then installed.
To see the public IP address of the VM, use the Get-AzPublicIpAddress cmdlet:
Get-AzPublicIpAddress -ResourceGroupName "myResourceGroup" | Select "IpAddress"
Use the following command to create a remote desktop session from your local computer. Replace the IP address with the public IP address of your VM.
mstsc /v:publicIpAddress
Clean up resources
When no longer needed, you can use the Remove-AzResourceGroup cmdlet to remove the resource group, VM, and all related resources:
Remove-AzResourceGroup -Name myResourceGroup
=====THIS WILL REMOVE EVERYTHING IN THE RESOURCE GROUP WITHOUT NEEDING TO SHUTDOWN VM FIRST=========
Friday, August 23, 2019
How to Install Python 3.6.1 in Ubuntu 16.04 LTS
This quick tutorial is going to show you how to install the latest Python 3.6.1 in Ubuntu 16.04 LTS via PPA.
Ubuntu 16.04 comes with both Python 2.7 and Python 3.5 by default. You can install Python 3.6 along with them via a third-party PPA by doing following steps:
1. Open terminal via Ctrl+Alt+T or searching for “Terminal” from app launcher. When it opens, run command to add the PPA:
sudo add-apt-repository ppa:jonathonf/python-3.6
Type in your password (no visual feedback due to security reason) when it asks and hit Enter.
2. Then check updates and install Python 3.6 via commands:
sudo apt-get update sudo apt-get install python3.6
Now you have three Python versions, use
python
command for version 2.7, python3
for version 3.5, and/or python3.6
for version 3.6.1.
3. To make
python3
use the new installed python 3.6 instead of the default 3.5 release, run following 2 commands:sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
Finally switch between the two python versions for
python3
via command:sudo update-alternatives --config python3
After selecting version 3.6:python3 -VUPDATE: due to this bug, gnome-terminal won’t launch after step 3, a workaround is running following commands to recreate the symlink:sudo rm /usr/bin/python3 sudo ln -s python3.5 /usr/bin/python3
Wednesday, August 21, 2019
Thursday, August 15, 2019
3850 RADIUS SERVER DEAD ISE
sh aaa server command to show when ISE is detected as dead on 3850 by looking at 'Platform State from SMD'
sh aaa server command to show when ISE is detected as dead on 3850 by looking at 'Platform State from SMD'
CISCO IOSXE GUESTSHELL RUN PYTHON
import sys
from cli import cli,clip,execute,executep,configure,configurep
>>> cli('conf t;int lo 55;end')
''
>>> clip('conf t;no int lo 55;end')
>>>
>>> cli('sh run int lo 55')
'\nBuilding configuration...\nCurrent configuration : 43 bytes\n!\ninterface Loopback55\n no ip address\nend\n'
>>>
>>> clip('conf t;no int lo 55;end;wr')
Building configuration...
[OK]
>>> clip('sh int lo 55')
Loopback55 is up, line protocol is up
Hardware is Loopback
MTU 1514 bytes, BW 8000000 Kbit/sec, DLY 5000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation LOOPBACK, loopback not set
Keepalive set (10 sec)
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
>>> configure(['int lo 55','ip add 5.5.5.5 255.255.255.255','end'])
[ConfigResult(success=True, command='int lo 55', line=1, output='', notes=None), ConfigResult(success=True, command='ip add 5.5.5.5 255.255.255.255', line=2, output='', notes=None), ConfigResult(success=True, command='end', line=3, output='', notes=None)]
!
interface Loopback55
ip address 5.5.5.5 255.255.255.255
end
>>> configurep(['int lo 55','ip add 5.5.5.5 255.255.255.255','end'])
Line 1 SUCCESS: int lo 55
Line 2 SUCCESS: ip add 5.5.5.5 255.255.255.255
Line 3 SUCCESS: end
>>> execute('sh int lo 55')
'Loopback55 is up, line protocol is up \n Hardware is Loopback\n MTU 1514 bytes, BW 8000000 Kbit/sec, DLY 5000 usec, \n reliability 255/255, txload 1/255, rxload 1/255\n Encapsulation LOOPBACK, loopback not set\n Keepalive set (10 sec)\n Last input never, output never, output hang never\n Last clearing of "show interface" counters never\n Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0\n Queueing strategy: fifo\n Output queue: 0/0 (size/max)\n 5 minute input rate 0 bits/sec, 0 packets/sec\n 5 minute output rate 0 bits/sec, 0 packets/sec\n 0 packets input, 0 bytes, 0 no buffer\n Received 0 broadcasts (0 IP multicasts)\n 0 runts, 0 giants, 0 throttles \n 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort\n 0 packets output, 0 bytes, 0 underruns\n 0 output errors, 0 collisions, 0 interface resets\n 0 unknown protocol drops\n 0 output buffer failures, 0 output buffers swapped out'
>>> executep('sh int lo 55')
Loopback55 is up, line protocol is up
Hardware is Loopback
MTU 1514 bytes, BW 8000000 Kbit/sec, DLY 5000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation LOOPBACK, loopback not set
Keepalive set (10 sec)
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
>>> execute('conf t;no int lo 55;end')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/cli/__init__.py", line 88, in execute
raise CLICommandError(command, "You may not run multiple commands using execute().")
cli.CLICommandError: You may not run multiple commands using execute().: There was a problem running the command: "conf t;no int lo 55;end"
import sys
from cli import cli,clip,execute,executep,configure,configurep
>>> cli('conf t;int lo 55;end')
''
>>> clip('conf t;no int lo 55;end')
>>>
>>> cli('sh run int lo 55')
'\nBuilding configuration...\nCurrent configuration : 43 bytes\n!\ninterface Loopback55\n no ip address\nend\n'
>>>
>>> clip('conf t;no int lo 55;end;wr')
Building configuration...
[OK]
>>> clip('sh int lo 55')
Loopback55 is up, line protocol is up
Hardware is Loopback
MTU 1514 bytes, BW 8000000 Kbit/sec, DLY 5000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation LOOPBACK, loopback not set
Keepalive set (10 sec)
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
>>> configure(['int lo 55','ip add 5.5.5.5 255.255.255.255','end'])
[ConfigResult(success=True, command='int lo 55', line=1, output='', notes=None), ConfigResult(success=True, command='ip add 5.5.5.5 255.255.255.255', line=2, output='', notes=None), ConfigResult(success=True, command='end', line=3, output='', notes=None)]
!
interface Loopback55
ip address 5.5.5.5 255.255.255.255
end
>>> configurep(['int lo 55','ip add 5.5.5.5 255.255.255.255','end'])
Line 1 SUCCESS: int lo 55
Line 2 SUCCESS: ip add 5.5.5.5 255.255.255.255
Line 3 SUCCESS: end
>>> execute('sh int lo 55')
'Loopback55 is up, line protocol is up \n Hardware is Loopback\n MTU 1514 bytes, BW 8000000 Kbit/sec, DLY 5000 usec, \n reliability 255/255, txload 1/255, rxload 1/255\n Encapsulation LOOPBACK, loopback not set\n Keepalive set (10 sec)\n Last input never, output never, output hang never\n Last clearing of "show interface" counters never\n Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0\n Queueing strategy: fifo\n Output queue: 0/0 (size/max)\n 5 minute input rate 0 bits/sec, 0 packets/sec\n 5 minute output rate 0 bits/sec, 0 packets/sec\n 0 packets input, 0 bytes, 0 no buffer\n Received 0 broadcasts (0 IP multicasts)\n 0 runts, 0 giants, 0 throttles \n 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort\n 0 packets output, 0 bytes, 0 underruns\n 0 output errors, 0 collisions, 0 interface resets\n 0 unknown protocol drops\n 0 output buffer failures, 0 output buffers swapped out'
>>> executep('sh int lo 55')
Loopback55 is up, line protocol is up
Hardware is Loopback
MTU 1514 bytes, BW 8000000 Kbit/sec, DLY 5000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation LOOPBACK, loopback not set
Keepalive set (10 sec)
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
>>> execute('conf t;no int lo 55;end')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/cli/__init__.py", line 88, in execute
raise CLICommandError(command, "You may not run multiple commands using execute().")
cli.CLICommandError: You may not run multiple commands using execute().: There was a problem running the command: "conf t;no int lo 55;end"
Monday, August 12, 2019
PYATS GENIE
name of device NEED TO MATCH HOSTNAME OF ROUTER/SWITCH OR IT WILL FAIL
GENIE LERAN ALL
GENIE DIFF - COMPARE NORMAL STATE TO PROBLEM STATE
RUN GENIE LEARN ALL DURING PROBLEM STATE THEN DO GENIE DIFF TO COMPARE THE TWO STATES
GENIE PARSE
RUN ON A PARTICULAR DEVICE FROM LIST
CAN NOT LEARN NXOS VPC YET
name of device NEED TO MATCH HOSTNAME OF ROUTER/SWITCH OR IT WILL FAIL
RUN PYTHON AND TEST CONNECT TO DEVICE
SEND CLI COMMAND TO DEVICE
GENIE LERAN ALL
GENIE DIFF - COMPARE NORMAL STATE TO PROBLEM STATE
RUN GENIE LEARN ALL DURING PROBLEM STATE THEN DO GENIE DIFF TO COMPARE THE TWO STATES
GENIE PARSE
RUN ON A PARTICULAR DEVICE FROM LIST
CAN NOT LEARN NXOS VPC YET
INSTALL PYATS GENIE WITH PYTHON 3.6 ON UBUNTU
mtadmin@ubuntu:~/Desktop$ sudo apt install python3.6 python3-venv python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.5.1-3).
python3.6 is already the newest version (3.6.9-1+xenial1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
mtadmin@ubuntu:~/Desktop$ python3.6 -m venv pyats36
mtadmin@ubuntu:~/Desktop$ ls
ansible GETFW ios_image myfiles pyats pyats36 Twisted-16.5.0rc2
mtadmin@ubuntu:~/Desktop$ cd pyats36
mtadmin@ubuntu:~/Desktop/pyats36$ source bin/activate
(pyats36) mtadmin@ubuntu:~/Desktop/pyats36$ pip install pyats genie
Collecting pyats
mtadmin@ubuntu:~/Desktop$ sudo apt install python3.6 python3-venv python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.5.1-3).
python3.6 is already the newest version (3.6.9-1+xenial1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
mtadmin@ubuntu:~/Desktop$ python3.6 -m venv pyats36
mtadmin@ubuntu:~/Desktop$ ls
ansible GETFW ios_image myfiles pyats pyats36 Twisted-16.5.0rc2
mtadmin@ubuntu:~/Desktop$ cd pyats36
mtadmin@ubuntu:~/Desktop/pyats36$ source bin/activate
(pyats36) mtadmin@ubuntu:~/Desktop/pyats36$ pip install pyats genie
Collecting pyats
(pyats36) mtadmin@ubuntu:~/Desktop/pyats36$ pip freeze
certifi==2019.6.16
chardet==3.0.4
dill==0.3.0
distro==1.4.0
idna==2.8
Jinja2==2.10.1
MarkupSafe==1.1.1
pathspec==0.5.9
pyats.async==19.7
pyats.connections==19.7
pyats.datastructures==19.7
pyats.kleenex==19.7
pyats.log==19.7
pyats.results==19.7
pyats.topology==19.7
pyats.utils==19.7
PyYAML==5.1.2
requests==2.22.0
unicon==19.7.5
urllib3==1.25.3
yamllint==1.17.0
(pyats36) mtadmin@ubuntu:~/Desktop/pyats36$ pip install genie
(pyats36) mtadmin@ubuntu:~/Desktop/pyats36$ pip freeze
asn1crypto==0.24.0
backports.ssl==0.0.9
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
cryptography==2.7
dill==0.3.0
distro==1.4.0
genie.abstract==19.7
genie.libs.filetransferutils==19.7
genie.libs.ops==19.7
genie.libs.sdk==19.7
genie.libs.telemetry==19.7
genie.ops==19.7
genie.parsergen==19.7
genie.predcore==19.7
genie.trafficgen==19.7.1
genie.utils==19.7
idna==2.8
IxNetwork==9.0.1915.16
Jinja2==2.10.1
MarkupSafe==1.1.1
pathspec==0.5.9
pyats.async==19.7
pyats.connections==19.7
pyats.datastructures==19.7
pyats.kleenex==19.7
pyats.log==19.7
pyats.results==19.7
pyats.topology==19.7
pyats.utils==19.7
pycparser==2.19
pyOpenSSL==19.0.0
PyYAML==5.1.2
requests==2.22.0
six==1.12.0
tqdm==4.33.0
unicon==19.7.5
urllib3==1.25.3
websocket-client==0.56.0
yamllint==1.17.0
INSTALL PYATS GENIE ON UBUNTU 16.04 LTS
need unrestricted internet access to do this without issues
sudo apt-get install python3-venv
mkdir pyats
cd pyats
python3 -m venv .
source bin/activate
pip install pyats genie
(pyats) admin@ubuntu:~/Desktop/pyats$ pip freeze asn1crypto==0.24.0 backports.ssl==0.0.9 certifi==2019.6.16 cffi==1.12.3 chardet==3.0.4 cryptography==2.7 dill==0.3.0 distro==1.4.0 genie==19.7.1 genie.abstract==19.7 genie.conf==19.7.1 genie.harness==19.7.2 genie.libs.conf==19.7 genie.libs.filetransferutils==19.7 genie.libs.ops==19.7 genie.libs.parser==19.7 genie.libs.sdk==19.7 genie.libs.telemetry==19.7 genie.metaparser==19.7 genie.ops==19.7 genie.parsergen==19.7 genie.predcore==19.7 genie.telemetry==19.7 genie.trafficgen==19.7.1 genie.utils==19.7 idna==2.8 IxNetwork==9.0.1915.16 Jinja2==2.10.1 jsonpickle==1.2 junit-xml==1.8 MarkupSafe==1.1.1 netaddr==0.7.19 pathspec==0.5.9 pkg-resources==0.0.0 prettytable==0.7.2 psutil==5.6.3 pyats==19.7 pyats.aereport==19.7 pyats.aetest==19.7 pyats.async==19.7 pyats.connections==19.7 pyats.datastructures==19.7 pyats.easypy==19.7 pyats.kleenex==19.7 pyats.log==19.7 pyats.results==19.7 pyats.tcl==19.7 pyats.topology==19.7 pyats.utils==19.7 pycparser==2.19 pyOpenSSL==19.0.0 PyYAML==5.1.2 requests==2.22.0 setproctitle==1.1.10 six==1.12.0 tqdm==4.33.0 unicon==19.7.5 urllib3==1.25.3 websocket-client==0.56.0 xmltodict==0.12.0 yamllint==1.17.0
need unrestricted internet access to do this without issues
sudo apt-get install python3-venv
cd pyats
python3 -m venv .
source bin/activate
pip install pyats genie
(pyats) admin@ubuntu:~/Desktop/pyats$ pip freeze asn1crypto==0.24.0 backports.ssl==0.0.9 certifi==2019.6.16 cffi==1.12.3 chardet==3.0.4 cryptography==2.7 dill==0.3.0 distro==1.4.0 genie==19.7.1 genie.abstract==19.7 genie.conf==19.7.1 genie.harness==19.7.2 genie.libs.conf==19.7 genie.libs.filetransferutils==19.7 genie.libs.ops==19.7 genie.libs.parser==19.7 genie.libs.sdk==19.7 genie.libs.telemetry==19.7 genie.metaparser==19.7 genie.ops==19.7 genie.parsergen==19.7 genie.predcore==19.7 genie.telemetry==19.7 genie.trafficgen==19.7.1 genie.utils==19.7 idna==2.8 IxNetwork==9.0.1915.16 Jinja2==2.10.1 jsonpickle==1.2 junit-xml==1.8 MarkupSafe==1.1.1 netaddr==0.7.19 pathspec==0.5.9 pkg-resources==0.0.0 prettytable==0.7.2 psutil==5.6.3 pyats==19.7 pyats.aereport==19.7 pyats.aetest==19.7 pyats.async==19.7 pyats.connections==19.7 pyats.datastructures==19.7 pyats.easypy==19.7 pyats.kleenex==19.7 pyats.log==19.7 pyats.results==19.7 pyats.tcl==19.7 pyats.topology==19.7 pyats.utils==19.7 pycparser==2.19 pyOpenSSL==19.0.0 PyYAML==5.1.2 requests==2.22.0 setproctitle==1.1.10 six==1.12.0 tqdm==4.33.0 unicon==19.7.5 urllib3==1.25.3 websocket-client==0.56.0 xmltodict==0.12.0 yamllint==1.17.0
Friday, August 9, 2019
CHECKING IOS-XE MEMORY
sh platform software status control-processor brief
Load Average
Slot Status 1-Min 5-Min 15-Min
1-RP0 Healthy 0.40 0.32 0.32
Memory (kB)
Slot Status Total Used (Pct) Free (Pct) Committed (Pct)
1-RP0 Warning 3983076 3686040 (93%) 297036 ( 7%) 4636040 (116%)
CPU Utilization
Slot CPU User System Nice Idle IRQ SIRQ IOwait
1-RP0 0 6.90 0.70 0.00 92.40 0.00 0.00 0.00
1 4.90 1.20 0.00 93.90 0.00 0.00 0.00
2 6.48 0.89 0.00 92.51 0.00 0.09 0.00
3 8.80 0.80 0.00 90.40 0.00 0.00 0.00
sh platform software status control-processor brief
Load Average
Slot Status 1-Min 5-Min 15-Min
1-RP0 Healthy 0.40 0.32 0.32
Memory (kB)
Slot Status Total Used (Pct) Free (Pct) Committed (Pct)
1-RP0 Warning 3983076 3686040 (93%) 297036 ( 7%) 4636040 (116%)
CPU Utilization
Slot CPU User System Nice Idle IRQ SIRQ IOwait
1-RP0 0 6.90 0.70 0.00 92.40 0.00 0.00 0.00
1 4.90 1.20 0.00 93.90 0.00 0.00 0.00
2 6.48 0.89 0.00 92.51 0.00 0.09 0.00
3 8.80 0.80 0.00 90.40 0.00 0.00 0.00
Tuesday, August 6, 2019
ANSIBLE CONCURRENT CONNECTION
default ansible connection is 5
or with a command line argument to ansible-playbook with the -f or –forks options. Note that this setting is dependent upon your hardware and software capabilities, such as network bandwidth and memory available on the control machine. Limit your forks according to your available resources.
use -f option to increase default to other number
ansible-playbook -f 10
default ansible connection is 5
1. Forks
Forks are the default number of parallel processes to spawn when communicating with remote hosts. If you are orchestrating your playbook across many servers, then you may have noticed that the number of servers where the playbook executes simultaneously is 5. You can increase this number inside the ansible.cfg file:
# ansible.cfg forks = 10
or with a command line argument to ansible-playbook with the -f or –forks options. Note that this setting is dependent upon your hardware and software capabilities, such as network bandwidth and memory available on the control machine. Limit your forks according to your available resources.
use -f option to increase default to other number
ansible-playbook -f 10
Subscribe to:
Posts (Atom)