本文整理汇总了Python中dm_utils.DMUtils.make_public_vrf_filter_name方法的典型用法代码示例。如果您正苦于以下问题:Python DMUtils.make_public_vrf_filter_name方法的具体用法?Python DMUtils.make_public_vrf_filter_name怎么用?Python DMUtils.make_public_vrf_filter_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm_utils.DMUtils
的用法示例。
在下文中一共展示了DMUtils.make_public_vrf_filter_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_inet_public_vrf_filter
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import make_public_vrf_filter_name [as 别名]
def add_inet_public_vrf_filter(self, forwarding_options_config, firewall_config, inet_type):
fo = Family()
inet_filter = InetFilter(input=DMUtils.make_public_vrf_filter_name(inet_type))
if inet_type == "inet6":
fo.set_inet6(FamilyInet6(filter=inet_filter))
else:
fo.set_inet(FamilyInet(filter=inet_filter))
forwarding_options_config.add_family(fo)
f = FirewallFilter(name=DMUtils.make_public_vrf_filter_name(inet_type))
ff = firewall_config.get_family()
if not ff:
ff = FirewallFamily()
firewall_config.set_family(ff)
if inet_type == "inet6":
inet6 = ff.get_inet6()
if not inet6:
inet6 = FirewallInet()
ff.set_inet6(inet6)
inet6.add_filter(f)
else:
inet = ff.get_inet()
if not inet:
inet = FirewallInet()
ff.set_inet(inet)
inet.add_filter(f)
term = Term(name="default-term", then=Then(accept=""))
f.add_term(term)
return f
示例2: add_inet_public_vrf_filter
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import make_public_vrf_filter_name [as 别名]
def add_inet_public_vrf_filter(self, forwarding_options_config,
firewall_config, inet_type, inet_xml_name):
fo = etree.SubElement(forwarding_options_config, "family")
inet = etree.SubElement(fo, inet_xml_name)
f = etree.SubElement(inet, "filter")
etree.SubElement(f, "input").text = DMUtils.make_public_vrf_filter_name(inet_type)
fc = etree.SubElement(firewall_config, "family")
inet = etree.SubElement(fc, inet_xml_name)
f = etree.SubElement(inet, "filter")
etree.SubElement(f, "name").text = DMUtils.make_public_vrf_filter_name(inet_type)
term = etree.SubElement(f, "term")
etree.SubElement(term, "name").text = "default-term"
then_ = etree.SubElement(term, "then")
etree.SubElement(then_, "accept")
return f
示例3: add_inet_public_vrf_filter
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import make_public_vrf_filter_name [as 别名]
def add_inet_public_vrf_filter(self, firewall_config, inet_type):
firewall_config.set_family(inet_type)
f = FirewallFilter(name=DMUtils.make_public_vrf_filter_name(inet_type))
f.set_comment(DMUtils.public_vrf_filter_comment())
firewall_config.add_firewall_filters(f)
term = Term(name="default-term", then=Then(accept_or_reject=True))
f.add_terms(term)
return f