Ejemplo n.º 1
0
 def init_global_switch_opts(self):
     if self.global_switch_options_config is None:
         self.global_switch_options_config = SwitchOptions(comment=DMUtils.switch_options_comment())
     self.global_switch_options_config.set_vtep_source_interface("lo0.0")
     if not self.routing_instances:
         # no vn config then no need to configure vrf target
         return
     self.global_switch_options_config.add_vrf_target(VniTarget(auto=''))
     switch_options_community = DMUtils.get_switch_vrf_import(self.get_asn())
     self.global_switch_options_config.add_vrf_target(VniTarget(community=switch_options_community))
Ejemplo n.º 2
0
 def init_global_switch_opts(self):
     if self.global_switch_options_config is None:
         self.global_switch_options_config = SwitchOptions(comment=DMUtils.switch_options_comment())
     self.global_switch_options_config.set_vtep_source_interface("lo0.0")
     if not self.routing_instances:
         # no vn config then no need to configure vrf target
         return
     self.global_switch_options_config.add_vrf_target(VniTarget(auto=''))
     switch_options_community = DMUtils.get_switch_vrf_import(self.get_asn())
     self.global_switch_options_config.add_vrf_target(VniTarget(community=switch_options_community))
Ejemplo n.º 3
0
 def set_route_targets_config(self):
     if self.policy_config is None:
         self.policy_config = PolicyOptions(comment=DMUtils.policy_options_comment())
     for route_target in self.route_targets:
         comm = CommunityType(name=DMUtils.make_community_name(route_target),
                              members=route_target)
         self.policy_config.add_community(comm)
     # add community for switch options
     comm = CommunityType(name=DMUtils.get_switch_policy_name(),
                              members=DMUtils.get_switch_vrf_import(self.get_asn()))
     self.policy_config.add_community(comm)
Ejemplo n.º 4
0
 def set_route_targets_config(self):
     if self.policy_config is None:
         self.policy_config = PolicyOptions(comment=DMUtils.policy_options_comment())
     for route_target in self.route_targets:
         comm = CommunityType(name=DMUtils.make_community_name(route_target),
                              members=route_target)
         self.policy_config.add_community(comm)
     # add community for switch options
     comm = CommunityType(name=DMUtils.get_switch_policy_name(),
                              members=DMUtils.get_switch_vrf_import(self.get_asn()))
     self.policy_config.add_community(comm)
Ejemplo n.º 5
0
 def set_route_targets_config(self):
     if self.policy_config is None:
         self.policy_config = PolicyOptions(comment=DMUtils.policy_options_comment())
     # add export community
     export_comm = CommunityType(name=DMUtils.get_switch_export_community_name())
     for route_target in self.route_targets:
         comm = CommunityType(name=DMUtils.make_community_name(route_target))
         comm.add_members(route_target)
         self.policy_config.add_community(comm)
         # add route-targets to export community
         export_comm.add_members(route_target)
     # if no members, no need to add community
     if export_comm.get_members():
         self.policy_config.add_community(export_comm)
     # add community for switch options
     comm = CommunityType(name=DMUtils.get_switch_policy_name())
     comm.add_members(DMUtils.get_switch_vrf_import(self.get_asn()))
     self.policy_config.add_community(comm)