-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d460c23
commit ef2e620
Showing
4 changed files
with
353 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from ncclient import manager | ||
|
||
eos=manager.connect(host="hostname", port="22", timeout=30, username="admin", password="", hostkey_verify=False) | ||
|
||
ethernet_trunk = ''' | ||
<config> | ||
<interfaces xmlns="http://openconfig.net/yang/interfaces"> | ||
<interface> | ||
<name>Ethernet3/1</name> | ||
<config> | ||
<name>Ethernet3/1</name> | ||
</config> | ||
<ethernet xmlns="http://openconfig.net/yang/interfaces/ethernet"> | ||
<switched-vlan xmlns="http://openconfig.net/yang/vlan" | ||
nc:operation="delete"> | ||
</switched-vlan> | ||
</ethernet> | ||
</interface> | ||
</interfaces> | ||
</config> | ||
''' | ||
|
||
configuration = eos.edit_config(target="running", config=ethernet_trunk, default_operation="merge") | ||
print(configuration) | ||
|
||
eos.close_session() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from ncclient import manager | ||
|
||
eos=manager.connect(host="hostname", port="22", timeout=30, username="admin", password="", hostkey_verify=False) | ||
|
||
config = """ | ||
<config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> | ||
<interfaces xmlns="http://openconfig.net/yang/interfaces"> | ||
<interface> | ||
<name>Ethernet4/1</name> | ||
<subinterfaces> | ||
<subinterface> | ||
<index>0</index> | ||
<ipv4 xmlns="http://openconfig.net/yang/interfaces/ip"> | ||
<addresses> | ||
<address nc:operation="delete"> | ||
<ip>172.168.14.2</ip> | ||
</address> | ||
</addresses> | ||
</ipv4> | ||
</subinterface> | ||
</subinterfaces> | ||
</interface> | ||
</interfaces> | ||
</config> | ||
""" | ||
|
||
configuration = eos.edit_config(target="running", config=config, default_operation="none") | ||
print(configuration) | ||
|
||
eos.close_session() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from ncclient import manager | ||
|
||
eos=manager.connect(host="hostname", port="22", timeout=30, username="admin", password="", hostkey_verify=False) | ||
|
||
isis = """ | ||
<config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> | ||
<network-instances xmlns="http://openconfig.net/yang/network-instance" | ||
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types" | ||
xmlns:oc-isis-types="http://openconfig.net/yang/isis-types" | ||
> | ||
<network-instance> | ||
<name> | ||
default | ||
</name> | ||
<protocols> | ||
<protocol> | ||
<identifier> | ||
oc-pol-types:ISIS | ||
</identifier> | ||
<name> | ||
SUPERCORE | ||
</name> | ||
<config> | ||
<identifier> | ||
oc-pol-types:ISIS | ||
</identifier> | ||
<name> | ||
SUPERCORE | ||
</name> | ||
</config> | ||
<isis> | ||
<interfaces> | ||
<interface nc:operation="delete"> | ||
<interface-id> | ||
Ethernet4/1 | ||
</interface-id> | ||
<config> | ||
<interface-id> | ||
Ethernet4/1 | ||
</interface-id> | ||
</config> | ||
</interface> | ||
</interfaces> | ||
</isis> | ||
</protocol> | ||
</protocols> | ||
</network-instance> | ||
</network-instances> | ||
</config> | ||
""" | ||
|
||
configuration = eos.edit_config(target="running", config=isis, default_operation="none") | ||
print(configuration) | ||
|
||
eos.close_session() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
from ncclient import manager | ||
eos=manager.connect(host="hostname", port="22", timeout=30, username="admin", password="", hostkey_verify=False) | ||
|
||
isis = """ | ||
<config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> | ||
<network-instances xmlns="http://openconfig.net/yang/network-instance" | ||
xmlns:oc-pol-types="http://openconfig.net/yang/policy-types" | ||
xmlns:oc-isis-types="http://openconfig.net/yang/isis-types" | ||
> | ||
<network-instance> | ||
<name> | ||
default | ||
</name> | ||
<protocols> | ||
<protocol> | ||
<identifier> | ||
oc-pol-types:ISIS | ||
</identifier> | ||
<name> | ||
SUPERCORE | ||
</name> | ||
<config> | ||
<enabled> | ||
true | ||
</enabled> | ||
<identifier> | ||
oc-pol-types:ISIS | ||
</identifier> | ||
<name> | ||
SUPERCORE | ||
</name> | ||
</config> | ||
<isis> | ||
<interfaces> | ||
<interface> | ||
<interface-id> | ||
Ethernet4/1 | ||
</interface-id> | ||
<config> | ||
<circuit-type> | ||
POINT_TO_POINT | ||
</circuit-type> | ||
<enabled> | ||
true | ||
</enabled> | ||
<hello-padding> | ||
STRICT | ||
</hello-padding> | ||
<interface-id> | ||
Ethernet4/1 | ||
</interface-id> | ||
<passive> | ||
false | ||
</passive> | ||
</config> | ||
<interface-ref> | ||
<config> | ||
<interface> | ||
Ethernet4/1 | ||
</interface> | ||
</config> | ||
</interface-ref> | ||
<levels> | ||
<level> | ||
<level-number> | ||
1 | ||
</level-number> | ||
<afi-safi> | ||
<af> | ||
<afi-name> | ||
oc-isis-types:IPV4 | ||
</afi-name> | ||
<safi-name> | ||
oc-isis-types:UNICAST | ||
</safi-name> | ||
<config> | ||
<afi-name> | ||
oc-isis-types:IPV4 | ||
</afi-name> | ||
<metric> | ||
10 | ||
</metric> | ||
<safi-name> | ||
oc-isis-types:UNICAST | ||
</safi-name> | ||
</config> | ||
</af> | ||
<af> | ||
<afi-name> | ||
oc-isis-types:IPV6 | ||
</afi-name> | ||
<safi-name> | ||
oc-isis-types:UNICAST | ||
</safi-name> | ||
<config> | ||
<afi-name> | ||
oc-isis-types:IPV6 | ||
</afi-name> | ||
<metric> | ||
GLOBAL_METRIC | ||
</metric> | ||
<safi-name> | ||
oc-isis-types:UNICAST | ||
</safi-name> | ||
</config> | ||
</af> | ||
</afi-safi> | ||
<config> | ||
<enabled> | ||
false | ||
</enabled> | ||
<level-number> | ||
1 | ||
</level-number> | ||
<priority> | ||
64 | ||
</priority> | ||
</config> | ||
<hello-authentication> | ||
<config> | ||
<hello-authentication> | ||
false | ||
</hello-authentication> | ||
</config> | ||
<key> | ||
<config/> | ||
</key> | ||
</hello-authentication> | ||
<packet-counters> | ||
<csnp/> | ||
<iih/> | ||
<lsp/> | ||
<psnp/> | ||
</packet-counters> | ||
<timers> | ||
<config> | ||
<hello-interval> | ||
10 | ||
</hello-interval> | ||
<hello-multiplier> | ||
3 | ||
</hello-multiplier> | ||
</config> | ||
</timers> | ||
</level> | ||
<level> | ||
<level-number> | ||
2 | ||
</level-number> | ||
<afi-safi> | ||
<af> | ||
<afi-name> | ||
oc-isis-types:IPV4 | ||
</afi-name> | ||
<safi-name> | ||
oc-isis-types:UNICAST | ||
</safi-name> | ||
<config> | ||
<afi-name> | ||
oc-isis-types:IPV4 | ||
</afi-name> | ||
<metric> | ||
10 | ||
</metric> | ||
<safi-name> | ||
oc-isis-types:UNICAST | ||
</safi-name> | ||
</config> | ||
</af> | ||
<af> | ||
<afi-name> | ||
oc-isis-types:IPV6 | ||
</afi-name> | ||
<safi-name> | ||
oc-isis-types:UNICAST | ||
</safi-name> | ||
<config> | ||
<afi-name> | ||
oc-isis-types:IPV6 | ||
</afi-name> | ||
<metric> | ||
GLOBAL_METRIC | ||
</metric> | ||
<safi-name> | ||
oc-isis-types:UNICAST | ||
</safi-name> | ||
</config> | ||
</af> | ||
</afi-safi> | ||
<config> | ||
<enabled> | ||
true | ||
</enabled> | ||
<level-number> | ||
2 | ||
</level-number> | ||
<priority> | ||
64 | ||
</priority> | ||
</config> | ||
<hello-authentication> | ||
<config> | ||
<hello-authentication> | ||
false | ||
</hello-authentication> | ||
</config> | ||
<key> | ||
<config/> | ||
</key> | ||
</hello-authentication> | ||
<packet-counters> | ||
<csnp/> | ||
<iih/> | ||
<lsp/> | ||
<psnp/> | ||
</packet-counters> | ||
<timers> | ||
<config> | ||
<hello-interval> | ||
10 | ||
</hello-interval> | ||
<hello-multiplier> | ||
3 | ||
</hello-multiplier> | ||
</config> | ||
</timers> | ||
</level> | ||
</levels> | ||
</interface> | ||
</interfaces> | ||
</isis> | ||
</protocol> | ||
</protocols> | ||
</network-instance> | ||
</network-instances> | ||
</config> | ||
""" | ||
|
||
configuration = eos.edit_config(target = "running", config = isis, default_operation="merge") | ||
print(configuration) | ||
|
||
eos.close_session() |