-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
14 changed files
with
672 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,12 @@ | ||
# Controller specification | ||
ctrlIpAddr: "172.22.18.186" | ||
ctrlPortNum: "8181" | ||
ctrlUname: 'admin' | ||
ctrlPswd: 'admin' | ||
|
||
# NetconfNode specification | ||
nodeName: "vRouter" | ||
nodeIpAddr: "172.22.17.107" | ||
nodePortNum: 830 | ||
nodeUname: "vyatta" | ||
nodePswd: "vyatta" |
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,49 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
import pybvc | ||
|
||
from pybvc.controller.netconfnode import NetconfNode | ||
from pybvc.common.status import STATUS | ||
from pybvc.controller.controller import Controller | ||
from pybvc.common.utils import load_dict_from_file | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
f = "cfg.yml" | ||
d = {} | ||
if(load_dict_from_file(f, d) == False): | ||
print("Config file '%s' read error: " % f) | ||
exit() | ||
|
||
try: | ||
ctrlIpAddr = d['ctrlIpAddr'] | ||
ctrlPortNum = d['ctrlPortNum'] | ||
ctrlUname = d['ctrlUname'] | ||
ctrlPswd = d['ctrlPswd'] | ||
|
||
nodeName = d['nodeName'] | ||
nodeIpAddr = d['nodeIpAddr'] | ||
nodePortNum = d['nodePortNum'] | ||
nodeUname = d['nodeUname'] | ||
nodePswd = d['nodePswd'] | ||
except: | ||
print ("Failed to get Controller device attributes") | ||
exit(0) | ||
|
||
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd) | ||
node = NetconfNode(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname, nodePswd) | ||
|
||
print (">>> Adding '%s' to the Controller '%s'" % (nodeName, ctrlIpAddr)) | ||
result = ctrl.add_netconf_node(node) | ||
status = result[0] | ||
if(status.eq(STATUS.OK) == True): | ||
print ("'%s' was successfully added to the Controller" % nodeName) | ||
else: | ||
print ("\n") | ||
print ("!!!Failed, reason: %s" % status.brief().lower()) | ||
exit(0) | ||
|
||
print "\n" | ||
|
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,52 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
import json | ||
import pybvc | ||
|
||
from pybvc.netconfdev.vrouter.vrouter5600 import VRouter5600 | ||
from pybvc.common.status import STATUS | ||
from pybvc.controller.controller import Controller | ||
from pybvc.common.utils import load_dict_from_file | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
f = "cfg.yml" | ||
d = {} | ||
if(load_dict_from_file(f, d) == False): | ||
print("Config file '%s' read error: " % f) | ||
exit() | ||
|
||
try: | ||
ctrlIpAddr = d['ctrlIpAddr'] | ||
ctrlPortNum = d['ctrlPortNum'] | ||
ctrlUname = d['ctrlUname'] | ||
ctrlPswd = d['ctrlPswd'] | ||
|
||
nodeName = d['nodeName'] | ||
nodeIpAddr = d['nodeIpAddr'] | ||
nodePortNum = d['nodePortNum'] | ||
nodeUname = d['nodeUname'] | ||
nodePswd = d['nodePswd'] | ||
except: | ||
print ("Failed to get Controller device attributes") | ||
exit(0) | ||
|
||
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd) | ||
vrouter = VRouter5600(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname, nodePswd) | ||
print ("<<< 'Controller': %s, '%s': %s" % (ctrlIpAddr, nodeName, nodeIpAddr)) | ||
|
||
print("\n") | ||
result = vrouter.get_cfg() | ||
status = result[0] | ||
if(status.eq(STATUS.OK) == True): | ||
print ("'%s' configuration:" % nodeName) | ||
cfg = result[1] | ||
data = json.loads(cfg) | ||
print json.dumps(data, indent=4) | ||
else: | ||
print ("\n") | ||
print ("Failed, reason: %s" % status.brief().lower()) | ||
print ("%s" % status.detail()) | ||
exit(0) |
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,50 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
import json | ||
import pybvc | ||
|
||
from pybvc.netconfdev.vrouter.vrouter5600 import VRouter5600 | ||
from pybvc.common.status import STATUS | ||
from pybvc.controller.controller import Controller | ||
from pybvc.common.utils import load_dict_from_file | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
f = "cfg.yml" | ||
d = {} | ||
if(load_dict_from_file(f, d) == False): | ||
print("Config file '%s' read error: " % f) | ||
exit() | ||
|
||
try: | ||
ctrlIpAddr = d['ctrlIpAddr'] | ||
ctrlPortNum = d['ctrlPortNum'] | ||
ctrlUname = d['ctrlUname'] | ||
ctrlPswd = d['ctrlPswd'] | ||
|
||
nodeName = d['nodeName'] | ||
nodeIpAddr = d['nodeIpAddr'] | ||
nodePortNum = d['nodePortNum'] | ||
nodeUname = d['nodeUname'] | ||
nodePswd = d['nodePswd'] | ||
except: | ||
print ("Failed to get Controller device attributes") | ||
exit(0) | ||
|
||
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd) | ||
vrouter = VRouter5600(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname, nodePswd) | ||
print ("<<< 'Controller': %s, '%s': %s" % (ctrlIpAddr, nodeName, nodeIpAddr)) | ||
|
||
result = vrouter.get_dataplane_interfaces_cfg() | ||
status = result[0] | ||
if(status.eq(STATUS.OK) == True): | ||
print "Dataplane interfaces config:" | ||
dpIfCfg = result[1] | ||
print json.dumps(dpIfCfg, indent=4) | ||
else: | ||
print ("\n") | ||
print ("!!!Failed, reason: %s" % status.brief().lower()) | ||
print ("%s" % status.detail()) | ||
exit(0) |
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,49 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
import json | ||
import pybvc | ||
|
||
from pybvc.netconfdev.vrouter.vrouter5600 import VRouter5600 | ||
from pybvc.common.status import STATUS | ||
from pybvc.controller.controller import Controller | ||
from pybvc.common.utils import load_dict_from_file | ||
|
||
if __name__ == "__main__": | ||
|
||
f = "cfg.yml" | ||
d = {} | ||
if(load_dict_from_file(f, d) == False): | ||
print("Config file '%s' read error: " % f) | ||
exit() | ||
|
||
try: | ||
ctrlIpAddr = d['ctrlIpAddr'] | ||
ctrlPortNum = d['ctrlPortNum'] | ||
ctrlUname = d['ctrlUname'] | ||
ctrlPswd = d['ctrlPswd'] | ||
|
||
nodeName = d['nodeName'] | ||
nodeIpAddr = d['nodeIpAddr'] | ||
nodePortNum = d['nodePortNum'] | ||
nodeUname = d['nodeUname'] | ||
nodePswd = d['nodePswd'] | ||
except: | ||
print ("Failed to get Controller device attributes") | ||
exit(0) | ||
|
||
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd) | ||
vrouter = VRouter5600(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname, nodePswd) | ||
print ("<<< 'Controller': %s, '%s': %s" % (ctrlIpAddr, nodeName, nodeIpAddr)) | ||
|
||
result = vrouter.get_dataplane_interfaces_list() | ||
status = result[0] | ||
if(status.eq(STATUS.OK) == True): | ||
print "Dataplane interfaces:" | ||
dpIfList = result[1] | ||
print json.dumps(dpIfList, indent=4) | ||
else: | ||
print ("\n") | ||
print ("!!!Failed, reason: %s" % status.brief().lower()) | ||
print ("%s" % status.detail()) | ||
exit(0) |
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,54 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
import json | ||
import pybvc | ||
|
||
from pybvc.netconfdev.vrouter.vrouter5600 import VRouter5600 | ||
from pybvc.common.status import STATUS | ||
from pybvc.controller.controller import Controller | ||
from pybvc.common.utils import load_dict_from_file | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
f = "cfg.yml" | ||
d = {} | ||
if(load_dict_from_file(f, d) == False): | ||
print("Config file '%s' read error: " % f) | ||
exit() | ||
|
||
try: | ||
ctrlIpAddr = d['ctrlIpAddr'] | ||
ctrlPortNum = d['ctrlPortNum'] | ||
ctrlUname = d['ctrlUname'] | ||
ctrlPswd = d['ctrlPswd'] | ||
|
||
nodeName = d['nodeName'] | ||
nodeIpAddr = d['nodeIpAddr'] | ||
nodePortNum = d['nodePortNum'] | ||
nodeUname = d['nodeUname'] | ||
nodePswd = d['nodePswd'] | ||
except: | ||
print ("Failed to get Controller device attributes") | ||
exit(0) | ||
|
||
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd) | ||
vrouter = VRouter5600(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname, nodePswd) | ||
print ("<<< 'Controller': %s, '%s': %s" % (ctrlIpAddr, nodeName, nodeIpAddr)) | ||
|
||
|
||
print("\n") | ||
print ("<<< Show firewalls configuration on the '%s'" % nodeName) | ||
result = vrouter.get_firewalls_cfg() | ||
status = result[0] | ||
if(status.eq(STATUS.OK) == True): | ||
print ("'%s' firewalls config:" % nodeName) | ||
cfg = result[1] | ||
data = json.loads(cfg) | ||
print json.dumps(data, indent=4) | ||
else: | ||
print ("\n") | ||
print ("!!!Failed, reason: %s" % status.brief().lower()) | ||
print ("%s" % status.detail()) | ||
exit(0) |
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,51 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
import json | ||
import pybvc | ||
|
||
from pybvc.netconfdev.vrouter.vrouter5600 import VRouter5600 | ||
from pybvc.common.status import STATUS | ||
from pybvc.controller.controller import Controller | ||
from pybvc.common.utils import load_dict_from_file | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
f = "cfg.yml" | ||
d = {} | ||
if(load_dict_from_file(f, d) == False): | ||
print("Config file '%s' read error: " % f) | ||
exit() | ||
|
||
try: | ||
ctrlIpAddr = d['ctrlIpAddr'] | ||
ctrlPortNum = d['ctrlPortNum'] | ||
ctrlUname = d['ctrlUname'] | ||
ctrlPswd = d['ctrlPswd'] | ||
|
||
nodeName = d['nodeName'] | ||
nodeIpAddr = d['nodeIpAddr'] | ||
nodePortNum = d['nodePortNum'] | ||
nodeUname = d['nodeUname'] | ||
nodePswd = d['nodePswd'] | ||
except: | ||
print ("Failed to get Controller device attributes") | ||
exit(0) | ||
|
||
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd) | ||
vrouter = VRouter5600(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname, nodePswd) | ||
print ("<<< 'Controller': %s, '%s': %s" % (ctrlIpAddr, nodeName, nodeIpAddr)) | ||
|
||
result = vrouter.get_interfaces_list() | ||
status = result[0] | ||
if(status.eq(STATUS.OK) == True): | ||
print "Interfaces:" | ||
ifList = result[1] | ||
print json.dumps(ifList, indent=4) | ||
else: | ||
print ("\n") | ||
print ("!!!Failed, reason: %s" % status.brief().lower()) | ||
print ("%s" % status.detail()) | ||
sys.exit(0) | ||
|
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,50 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
import json | ||
import pybvc | ||
|
||
from pybvc.netconfdev.vrouter.vrouter5600 import VRouter5600 | ||
from pybvc.common.status import STATUS | ||
from pybvc.controller.controller import Controller | ||
from pybvc.common.utils import load_dict_from_file | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
f = "cfg.yml" | ||
d = {} | ||
if(load_dict_from_file(f, d) == False): | ||
print("Config file '%s' read error: " % f) | ||
exit() | ||
|
||
try: | ||
ctrlIpAddr = d['ctrlIpAddr'] | ||
ctrlPortNum = d['ctrlPortNum'] | ||
ctrlUname = d['ctrlUname'] | ||
ctrlPswd = d['ctrlPswd'] | ||
|
||
nodeName = d['nodeName'] | ||
nodeIpAddr = d['nodeIpAddr'] | ||
nodePortNum = d['nodePortNum'] | ||
nodeUname = d['nodeUname'] | ||
nodePswd = d['nodePswd'] | ||
except: | ||
print ("Failed to get Controller device attributes") | ||
exit(0) | ||
|
||
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd) | ||
vrouter = VRouter5600(ctrl, nodeName, nodeIpAddr, nodePortNum, nodeUname, nodePswd) | ||
print ("<<< 'Controller': %s, '%s': %s" % (ctrlIpAddr, nodeName, nodeIpAddr)) | ||
|
||
result = vrouter.get_loopback_interfaces_cfg() | ||
status = result[0] | ||
if(status.eq(STATUS.OK) == True): | ||
print "Loopback interfaces config:" | ||
dpIfCfg = result[1] | ||
print json.dumps(dpIfCfg, indent=4) | ||
else: | ||
print ("\n") | ||
print ("!!!Failed, reason: %s" % status.brief().lower()) | ||
print ("%s" % status.detail()) | ||
sys.exit(0) |
Oops, something went wrong.