本文整理汇总了Python中pybvc.controller.controller.Controller.get_schema方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.get_schema方法的具体用法?Python Controller.get_schema怎么用?Python Controller.get_schema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybvc.controller.controller.Controller
的用法示例。
在下文中一共展示了Controller.get_schema方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: nc_demo_2
# 需要导入模块: from pybvc.controller.controller import Controller [as 别名]
# 或者: from pybvc.controller.controller.Controller import get_schema [as 别名]
def nc_demo_2():
f = "cfg1.yml"
d = {}
if(load_dict_from_file(f, d) is False):
print("Config file '%s' read error: " % f)
exit()
try:
ctrlIpAddr = d['ctrlIpAddr']
ctrlPortNum = d['ctrlPortNum']
ctrlUname = d['ctrlUname']
ctrlPswd = d['ctrlPswd']
rundelay = d['rundelay']
except:
print ("Failed to get Controller device attributes")
exit(0)
print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
print ("<<< Demo Start")
print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
print ("\n")
print ("<<< Creating Controller instance")
time.sleep(rundelay)
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
print ("'Controller':")
print ctrl.to_json()
print "\n"
yangModelName = "flow-topology-discovery"
yangModelVerson = "2013-08-19"
print ("<<< Retrieve '%s' YANG model definition "
"from the Controller" % yangModelName)
time.sleep(rundelay)
nodeName = "controller-config"
result = ctrl.get_schema(nodeName, yangModelName, yangModelVerson)
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("YANG model:")
schema = result.get_data()
print schema
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief())
exit(0)
print ("\n")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
print (">>> Demo End")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
示例2: print
# 需要导入模块: from pybvc.controller.controller import Controller [as 别名]
# 或者: from pybvc.controller.controller.Controller import get_schema [as 别名]
print ("\n")
print ("<<< Creating Controller instance")
time.sleep(rundelay)
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
print ("'Controller':")
print ctrl.to_json()
print "\n"
yangModelName = "flow-topology-discovery"
yangModelVerson = "2013-08-19"
print ("<<< Retrieve '%s' YANG model definition from the Controller" % yangModelName)
time.sleep(rundelay)
nodeName = "controller-config"
result = ctrl.get_schema(nodeName, yangModelName, yangModelVerson)
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("YANG model:")
schema = result.get_data()
print schema
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief())
exit(0)
print ("\n")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
print (">>> Demo End")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
示例3: in
# 需要导入模块: from pybvc.controller.controller import Controller [as 别名]
# 或者: from pybvc.controller.controller.Controller import get_schema [as 别名]
for opt, arg in opts:
if opt in ("-h", "--help"):
usage(sys.argv[0])
elif opt in ("-i", "--identifier"):
model_identifier = arg
elif opt in ("-v", "--version"):
model_version = arg
else:
print("Error: failed to parse option %s" % opt)
usage(sys.argv[0])
if(model_identifier == None) or (model_version == None):
print("Error: incomplete command")
usage(sys.argv[0])
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
print ("<<< 'Controller': %s" % (ctrlIpAddr))
result = ctrl.get_schema("controller-config", model_identifier, model_version)
status = result.get_status()
if(status.eq(STATUS.OK) == True):
print "YANG model definition:"
schema = result.get_data()
print schema.encode('utf-8', 'replace')
else:
print ("\n")
print ("!!!Failed, reason: %s" % status.brief().lower())
print ("%s" % status.detailed())
exit(0)
print ("\n")
示例4: print
# 需要导入模块: from pybvc.controller.controller import Controller [as 别名]
# 或者: from pybvc.controller.controller.Controller import get_schema [as 别名]
print json.dumps(slist, default=lambda o: o.__dict__, sort_keys=True, indent=4)
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief())
exit(0)
print "\n"
print ("<<< Get list of YANG models supported by the Controller")
time.sleep(rundelay)
nodeName = "controller-config"
empty = False
nonempty = False
for aModel in result[1]:
print "Schema for %s:" % aModel['identifier']
theSchema = ctrl.get_schema(nodeName, aModel['identifier'], aModel['version'])
status = theSchema[0]
if(status.eq(STATUS.OK)):
slist = theSchema[1]
nonempty = True
print json.dumps(slist, default=lambda o: o.__dict__, sort_keys=True, indent=4)
else:
empty = True
continue
if (empty):
print "Set log level to TRACE for org.opendaylight.controller.netconf in karaf, run this again, then check log file for schemas"
print "On BVC server:"
print " /opt/bvc/bin/start"
print " <wait for it to start>"
print " /opt/bvc/bin/client"
print " At the karaf prompt:"