本文整理汇总了Python中ydk.services.CodecService类的典型用法代码示例。如果您正苦于以下问题:Python CodecService类的具体用法?Python CodecService怎么用?Python CodecService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CodecService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_oc_nis_decode
def test_oc_nis_decode(self):
codec_provider = CodecServiceProvider(type='xml')
codec = CodecService()
nis_top = oc_nis.NetworkInstances()
entity = codec.decode(codec_provider, nis_xml, nis_top);
self.assertIsNotNone(entity)
开发者ID:CiscoDevNet,项目名称:ydk-gen,代码行数:7,代码来源:test_oc_nis.py
示例2: _get_decoded_entity
def _get_decoded_entity():
from ydk.providers import CodecServiceProvider
from ydk.services import CodecService
payload = '''
<system xmlns="urn:ietf:params:xml:ns:yang:ietf-system">
<contact>[email protected]</contact>
<hostname>1.2.3.4</hostname>
<clock>
<timezone-name>Argentina</timezone-name>
</clock>
<ntp>
<server>
<name>xyz</name>
<udp>
<address>1.2.3.4</address>
<port>22</port>
</udp>
<association-type>peer</association-type>
</server>
</ntp>
<dns-resolver>
<search>abc.com</search>
<search>fff.com</search>
<server>
<name>abc</name>
<udp-and-tcp>
<address>1.2.3.4</address>
<port>830</port>
</udp-and-tcp>
</server>
</dns-resolver>
<authentication>
<user>
<name>guest</name>
<password>guest</password>
</user>
<user>
<name>admin</name>
<password>admin</password>
</user>
</authentication>
</system>
'''
codec = CodecService()
provider = CodecServiceProvider(type='xml')
return codec.decode(provider, payload)
开发者ID:111pontes,项目名称:ydk-gen,代码行数:47,代码来源:ietf_system.py
示例3: run_multiple_routing_bgp
def run_multiple_routing_bgp(netconf_service, session):
crud = CRUDService()
codec = CodecService()
codec_provider = CodecServiceProvider()
crud.delete(session, bgp())
crud.delete(session, RoutingPolicy())
multi_cfg = _get_bgp_routing_multiple_object()
multi_payload_expected = codec.encode(codec_provider, multi_cfg)
result = netconf_service.edit_config(session, Datastore.candidate, multi_cfg)
assert 'ok' in result
multi_filter = {'bgp':bgp(), 'routing-policy':RoutingPolicy()}
multi_entity_read = netconf_service.get_config(session, Datastore.candidate, multi_filter)
multi_payload_actual = codec.encode(codec_provider, multi_entity_read)
assert multi_payload_expected == multi_payload_actual
开发者ID:mirceaulinic,项目名称:ydk-py,代码行数:20,代码来源:bgp_netconf.py
示例4: setUpClass
def setUpClass(self):
self.codec = CodecService()
self.provider = CodecServiceProvider(type='xml')
self._enum_payload_1 = \
'<built-in-t xmlns="http://cisco.com/ns/yang/ydktest-sanity">\n <enum-value>local</enum-value>\n</built-in-t>\n'
self._enum_payload_2 = \
'<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">\n <ytypes>\n <built-in-t>\n <enum-value>local</enum-value>\n </built-in-t>\n </ytypes>\n</runner>\n'
self._runner_payload = \
'<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">\n\
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:12,代码来源:test_sanity_codec.py
示例5: setUpClass
def setUpClass(self):
self.codec = CodecService()
self.provider = CodecServiceProvider(type='xml')
self._enum_payload_1 = '''<built-in-t xmlns="http://cisco.com/ns/yang/ydktest-sanity">
<enum-value>local</enum-value>
</built-in-t>
'''
self._enum_payload_2 = '''<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">
<ytypes>
<built-in-t>
<enum-value>local</enum-value>
</built-in-t>
</ytypes>
</runner>
'''
self._runner_payload = '''<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">
<two-list>
<ldata>
<number>21</number>
<name>runner:twolist:ldata[21]:name</name>
<subl1>
<number>211</number>
<name>runner:twolist:ldata[21]:subl1[211]:name</name>
</subl1>
<subl1>
<number>212</number>
<name>runner:twolist:ldata[21]:subl1[212]:name</name>
</subl1>
</ldata>
<ldata>
<number>22</number>
<name>runner:twolist:ldata[22]:name</name>
<subl1>
<number>221</number>
<name>runner:twolist:ldata[22]:subl1[221]:name</name>
</subl1>
<subl1>
<number>222</number>
<name>runner:twolist:ldata[22]:subl1[222]:name</name>
</subl1>
</ldata>
</two-list>
</runner>
'''
self._oc_pattern_payload = '''<oc-A xmlns="http://cisco.com/ns/yang/oc-pattern">
开发者ID:manradhaCisco,项目名称:ydk-gen,代码行数:48,代码来源:test_sanity_codec.py
示例6: setUpClass
def setUpClass(self):
self.codec = CodecService()
self.provider = CodecServiceProvider(type=EncodingFormat.XML)
self._enum_payload_1 = """<built-in-t xmlns="http://cisco.com/ns/yang/ydktest-sanity">
<enum-value>local</enum-value>
</built-in-t>
"""
self._enum_payload_2 = """<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">
<ytypes>
<built-in-t>
<enum-value>local</enum-value>
</built-in-t>
</ytypes>
</runner>"""
self._runner_payload = """<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">
开发者ID:111pontes,项目名称:ydk-gen,代码行数:18,代码来源:test_sanity_service_errors.py
示例7: ArgumentParser
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
grpc = xr_man_ems_cfg.Grpc() # create object
config_grpc(grpc) # add object configuration
# encode and print object
print(codec.encode(provider, grpc))
exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-man-ems-cfg-25-ydk.py
示例8: ArgumentParser
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
rsvp = xr_ip_rsvp_cfg.Rsvp() # create object
config_rsvp(rsvp) # add object configuration
# encode and print object
print(codec.encode(provider, rsvp))
exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-ip-rsvp-cfg-22-ydk.py
示例9: ArgumentParser
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
locale = xr_infra_infra_locale_cfg.Locale() # create object
config_locale(locale) # add object configuration
# encode and print object
print(codec.encode(provider, locale))
provider.close()
exit()
# End of script
开发者ID:abhikeshav,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-infra-infra-locale-cfg-26-ydk.py
示例10: ArgumentParser
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
ip_domain = xr_ip_domain_cfg.IpDomain() # create object
config_ip_domain(ip_domain) # add object configuration
# encode and print object
print(codec.encode(provider, ip_domain))
exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-ip-domain-cfg-25-ydk.py
示例11: ArgumentParser
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
native = xe_native.Native() # create object
config_native(native) # add object configuration
# encode and print object
print(codec.encode(provider, native))
exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xe-native-interface-32-ydk.py
示例12: SanityYang
class SanityYang(unittest.TestCase):
@classmethod
def setUpClass(self):
self.codec = CodecService()
self.provider = CodecServiceProvider(type='xml')
self._enum_payload_1 = '''<built-in-t xmlns="http://cisco.com/ns/yang/ydktest-sanity">
<enum-value>local</enum-value>
</built-in-t>
'''
self._enum_payload_2 = '''<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">
<ytypes>
<built-in-t>
<enum-value>local</enum-value>
</built-in-t>
</ytypes>
</runner>
'''
self._runner_payload = '''<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">
<two-list>
<ldata>
<number>21</number>
<name>runner:twolist:ldata[21]:name</name>
<subl1>
<number>211</number>
<name>runner:twolist:ldata[21]:subl1[211]:name</name>
</subl1>
<subl1>
<number>212</number>
<name>runner:twolist:ldata[21]:subl1[212]:name</name>
</subl1>
</ldata>
<ldata>
<number>22</number>
<name>runner:twolist:ldata[22]:name</name>
<subl1>
<number>221</number>
<name>runner:twolist:ldata[22]:subl1[221]:name</name>
</subl1>
<subl1>
<number>222</number>
<name>runner:twolist:ldata[22]:subl1[222]:name</name>
</subl1>
</ldata>
</two-list>
</runner>
'''
self._oc_pattern_payload = '''<oc-A xmlns="http://cisco.com/ns/yang/oc-pattern">
<a>Hello</a>
</oc-A>
'''
@classmethod
def tearDownClass(self):
pass
def setUp(self):
pass
def tearDown(self):
pass
def _get_runner_entity(self):
r_1 = ysanity.Runner()
e_1, e_2 = ysanity.Runner.TwoList.Ldata(), ysanity.Runner.TwoList.Ldata()
e_11, e_12 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
e_1.number = 21
e_1.name = 'runner:twolist:ldata[' + str(e_1.number) + ']:name'
e_11.number = 211
e_11.name = 'runner:twolist:ldata[' + str(e_1.number) + ']:subl1[' + str(e_11.number) + ']:name'
e_12.number = 212
e_12.name = 'runner:twolist:ldata[' + str(e_1.number) + ']:subl1[' + str(e_12.number) + ']:name'
e_1.subl1.extend([e_11, e_12])
e_21, e_22 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
e_2.number = 22
e_2.name = 'runner:twolist:ldata[' + str(e_2.number) + ']:name'
e_21.number = 221
e_21.name = 'runner:twolist:ldata[' + str(e_2.number) + ']:subl1[' + str(e_21.number) + ']:name'
e_22.number = 222
e_22.name = 'runner:twolist:ldata[' + str(e_2.number) + ']:subl1[' + str(e_22.number) + ']:name'
e_2.subl1.extend([e_21, e_22])
r_1.two_list.ldata.extend([e_1, e_2])
return r_1
def test_encode_1(self):
r_1 = self._get_runner_entity()
payload = self.codec.encode(self.provider, r_1)
self.assertEqual(self._runner_payload, payload)
def test_encode_2(self):
from ydk.models.ydktest_sanity import YdkEnumTestEnum
r_1 = ysanity.Runner.Ytypes.BuiltInT()
r_1.enum_value = YdkEnumTestEnum.LOCAL
payload = self.codec.encode(self.provider, r_1)
self.assertEqual(self._enum_payload_1, payload)
def test_encode_invalid_1(self):
#.........这里部分代码省略.........
开发者ID:manradhaCisco,项目名称:ydk-gen,代码行数:101,代码来源:test_sanity_codec.py
示例13: ArgumentParser
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
global_interface_configuration = xr_ifmgr_cfg.GlobalInterfaceConfiguration() # create object
config_global_interface_configuration(global_interface_configuration) # add object configuration
# encode and print object
print(codec.encode(provider, global_interface_configuration))
provider.close()
exit()
# End of script
开发者ID:abhikeshav,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-ifmgr-cfg-20-ydk.py
示例14: ArgumentParser
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
bgp = xr_ipv4_bgp_cfg.Bgp() # create object
config_bgp(bgp) # add object configuration
# encode and print object
print(codec.encode(provider, bgp))
provider.close()
exit()
# End of script
开发者ID:abhikeshav,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-ipv4-bgp-cfg-44-ydk.py
示例15: ArgumentParser
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
ntp = xr_ip_ntp_cfg.Ntp() # create object
config_ntp(ntp) # add object configuration
# encode and print object
print(codec.encode(provider, ntp))
exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-ip-ntp-cfg-25-ydk.py
示例16: SanityYang
class SanityYang(unittest.TestCase):
@classmethod
def setUpClass(self):
self.codec = CodecService()
self.provider = CodecServiceProvider(type='xml')
self._enum_payload_1 = \
'<built-in-t xmlns="http://cisco.com/ns/yang/ydktest-sanity">\n <enum-value>local</enum-value>\n</built-in-t>\n'
self._enum_payload_2 = \
'<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">\n <ytypes>\n <built-in-t>\n <enum-value>local</enum-value>\n </built-in-t>\n </ytypes>\n</runner>\n'
self._runner_payload = \
'<runner xmlns="http://cisco.com/ns/yang/ydktest-sanity">\n\
<two-list>\n\
<ldata>\n\
<number>21</number>\n\
<name>runner:twolist:ldata[21]:name</name>\n\
<subl1>\n\
<number>211</number>\n\
<name>runner:twolist:ldata[21]:subl1[211]:name</name>\n\
</subl1>\n\
<subl1>\n\
<number>212</number>\n\
<name>runner:twolist:ldata[21]:subl1[212]:name</name>\n\
</subl1>\n\
</ldata>\n\
<ldata>\n\
<number>22</number>\n\
<name>runner:twolist:ldata[22]:name</name>\n\
<subl1>\n\
<number>221</number>\n\
<name>runner:twolist:ldata[22]:subl1[221]:name</name>\n\
</subl1>\n\
<subl1>\n\
<number>222</number>\n\
<name>runner:twolist:ldata[22]:subl1[222]:name</name>\n\
</subl1>\n\
</ldata>\n\
</two-list>\n\
</runner>\n'
@classmethod
def tearDownClass(self):
pass
def setUp(self):
print '\nIn method', self._testMethodName + ':'
def tearDown(self):
pass
def _get_runner_entity(self):
r_1 = ysanity.Runner()
e_1, e_2 = ysanity.Runner.TwoList.Ldata(), ysanity.Runner.TwoList.Ldata()
e_11, e_12 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
e_1.number = 21
e_1.name = 'runner:twolist:ldata[' + str(e_1.number) + ']:name'
e_11.number = 211
e_11.name = 'runner:twolist:ldata[' + str(e_1.number) + ']:subl1[' + str(e_11.number) + ']:name'
e_12.number = 212
e_12.name = 'runner:twolist:ldata[' + str(e_1.number) + ']:subl1[' + str(e_12.number) + ']:name'
e_1.subl1.extend([e_11, e_12])
e_21, e_22 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
e_2.number = 22
e_2.name = 'runner:twolist:ldata[' + str(e_2.number) + ']:name'
e_21.number = 221
e_21.name = 'runner:twolist:ldata[' + str(e_2.number) + ']:subl1[' + str(e_21.number) + ']:name'
e_22.number = 222
e_22.name = 'runner:twolist:ldata[' + str(e_2.number) + ']:subl1[' + str(e_22.number) + ']:name'
e_2.subl1.extend([e_21, e_22])
r_1.two_list.ldata.extend([e_1, e_2])
return r_1
def test_encode_1(self):
r_1 = self._get_runner_entity()
payload = self.codec.encode(self.provider, r_1)
self.assertEqual(self._runner_payload, payload)
def test_encode_2(self):
from ydk.models.ydktest.ydktest_sanity import YdkEnumTestEnum
r_1 = ysanity.Runner.Ytypes.BuiltInT()
r_1.enum_value = YdkEnumTestEnum.LOCAL
payload = self.codec.encode(self.provider, r_1)
self.assertEqual(self._enum_payload_1, payload)
def test_decode_1(self):
entity = self.codec.decode(self.provider, self._enum_payload_2)
self.assertEqual(self._enum_payload_2, self.codec.encode(self.provider, entity))
def test_encode_decode(self):
r_1 = self._get_runner_entity()
payload = self.codec.encode(self.provider, r_1)
entity = self.codec.decode(self.provider, payload)
self.assertEqual(is_equal(r_1, entity), True)
self.assertEqual(payload, self.codec.encode(self.provider, entity))
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:97,代码来源:test_sanity_codec.py
示例17: ArgumentParser
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
telemetry_system = oc_telemetry.TelemetrySystem() # create object
config_telemetry_system(telemetry_system) # add object configuration
# encode and print object
print(codec.encode(provider, telemetry_system))
exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-oc-telemetry-34-ydk.py
示例18: ArgumentParser
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
interface_configurations = xr_ifmgr_cfg.InterfaceConfigurations() # create object
config_interface_configurations(interface_configurations) # add object configuration
# encode and print object
print(codec.encode(provider, interface_configurations))
exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-ifmgr-cfg-34-ydk.py
示例19: ArgumentParser
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
ipv4_acl_and_prefix_list = xr_ipv4_acl_cfg.Ipv4AclAndPrefixList() # create object
config_ipv4_acl_and_prefix_list(ipv4_acl_and_prefix_list) # add object configuration
# encode and print object
print(codec.encode(provider, ipv4_acl_and_prefix_list))
exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-ipv4-acl-cfg-86-ydk.py
示例20: ArgumentParser
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
args = parser.parse_args()
# log debug messages if verbose argument specified
if args.verbose:
logger = logging.getLogger("ydk")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - "
"%(levelname)s - %(message)s"))
handler.setFormatter(formatter)
logger.addHandler(handler)
# create codec provider
provider = CodecServiceProvider(type="xml")
# create codec service
codec = CodecService()
telemetry_model_driven = xr_telemetry_model_driven_cfg.TelemetryModelDriven() # create object
config_telemetry_model_driven(telemetry_model_driven) # add object configuration
# encode and print object
print(codec.encode(provider, telemetry_model_driven))
exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:30,代码来源:cd-encode-xr-telemetry-model-driven-cfg-24-ydk.py
注:本文中的ydk.services.CodecService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论