本文整理汇总了Python中dm_utils.DMUtils.si_ps_comment方法的典型用法代码示例。如果您正苦于以下问题:Python DMUtils.si_ps_comment方法的具体用法?Python DMUtils.si_ps_comment怎么用?Python DMUtils.si_ps_comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm_utils.DMUtils
的用法示例。
在下文中一共展示了DMUtils.si_ps_comment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_routing_instance
# 需要导入模块: from dm_utils import DMUtils [as 别名]
# 或者: from dm_utils.DMUtils import si_ps_comment [as 别名]
#.........这里部分代码省略.........
static_config = Static()
ri_opt.set_static(static_config)
static_config.add_route(Route(name="0.0.0.0/0",
next_hop=interfaces[0].name,
comment=DMUtils.fip_ingress_comment()))
ri.add_interface(Interface(name=interfaces[0].name))
public_vrf_ips = {}
for pip in fip_map.values():
if pip["vrf_name"] not in public_vrf_ips:
public_vrf_ips[pip["vrf_name"]] = set()
public_vrf_ips[pip["vrf_name"]].add(pip["floating_ip"])
for public_vrf, fips in public_vrf_ips.items():
ri_public = Instance(name=public_vrf)
ri_config.add_instance(ri_public)
ri_public.add_interface(Interface(name=interfaces[1].name))
ri_opt = RoutingInstanceRoutingOptions()
ri_public.set_routing_options(ri_opt)
static_config = Static()
ri_opt.set_static(static_config)
for fip in fips:
static_config.add_route(Route(name=fip + "/32",
next_hop=interfaces[1].name,
comment=DMUtils.fip_egress_comment()))
# add policies for export route targets
ps = PolicyStatement(name=DMUtils.make_export_name(ri_name))
if vn:
ps.set_comment(DMUtils.vn_ps_comment(vn, "Export"))
elif si:
ps.set_comment(DMUtils.si_ps_comment(si, "Export"))
then = Then()
ps.add_term(Term(name="t1", then=then))
for route_target in export_targets:
comm = Community(add='',
community_name=DMUtils.make_community_name(route_target))
then.add_community(comm)
if fip_map is not None:
# for nat instance
then.set_reject('')
else:
then.set_accept('')
policy_config.add_policy_statement(ps)
# add policies for import route targets
ps = PolicyStatement(name=DMUtils.make_import_name(ri_name))
if vn:
ps.set_comment(DMUtils.vn_ps_comment(vn, "Import"))
elif si:
ps.set_comment(DMUtils.si_ps_comment(si, "Import"))
from_ = From()
term = Term(name="t1", fromxx=from_)
ps.add_term(term)
for route_target in import_targets:
from_.add_community(DMUtils.make_community_name(route_target))
term.set_then(Then(accept=''))
ps.set_then(Then(reject=''))
policy_config.add_policy_statement(ps)
# add firewall config for public VRF
forwarding_options_config = self.forwarding_options_config
firewall_config = self.firewall_config
if router_external and is_l2 == False: