本文整理汇总了Python中dm_utils.DMUtils.get_ipv6_prefixes方法的典型用法代码示例。如果您正苦于以下问题:Python DMUtils.get_ipv6_prefixes方法的具体用法?Python DMUtils.get_ipv6_prefixes怎么用?Python DMUtils.get_ipv6_prefixes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm_utils.DMUtils
的用法示例。
在下文中一共展示了DMUtils.get_ipv6_prefixes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_inet_filter_term
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import get_ipv6_prefixes [as 别名]
def add_inet_filter_term(self, ri_name, prefixes, inet_type):
if inet_type == "inet6":
prefixes = DMUtils.get_ipv6_prefixes(prefixes)
else:
prefixes = DMUtils.get_ipv4_prefixes(prefixes)
from_ = From()
for prefix in prefixes:
from_.add_destination_address(prefix)
then_ = Then()
then_.add_routing_instance(ri_name)
return Term(name=DMUtils.make_vrf_term_name(ri_name), fromxx=from_, then=then_)
示例2: add_inet_filter_term
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import get_ipv6_prefixes [as 别名]
def add_inet_filter_term(self, ri_name, prefixes, inet_type):
term = etree.Element("term")
etree.SubElement(term, "name").text = DMUtils.make_vrf_term_name(ri_name)
from_ = etree.SubElement(term, "from")
if inet_type == 'inet6':
prefixes = DMUtils.get_ipv6_prefixes(prefixes)
else:
prefixes = DMUtils.get_ipv4_prefixes(prefixes)
for prefix in prefixes:
etree.SubElement(from_, "destination-address").text = prefix
then_ = etree.SubElement(term, "then")
etree.SubElement(then_, "routing-instance").text = ri_name
return term