def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if self._args.router_asn and not self._args.oper: self._vnc_lib = VncApi( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, '/', api_auth_protocol="https") # Update global system config also with this ASN gsc_obj = self._vnc_lib.global_system_config_read( fq_name=['default-global-system-config']) gsc_obj.set_autonomous_system(self._args.router_asn) self._vnc_lib.global_system_config_update(gsc_obj) return bp_obj = BgpProvisioner( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) if self._args.oper == 'add': bp_obj.add_bgp_router('contrail', self._args.host_name, self._args.host_ip, self._args.router_asn) elif self._args.oper == 'del': bp_obj.del_bgp_router(self._args.host_name) else: print "Unknown operation %s. Only 'add' and 'del' supported"\ % (self._args.oper)
def __init__(self, args_str=None): self._args = None if not args_str: args_str = " ".join(sys.argv[1:]) self._parse_args(args_str) if self._args.router_asn and not self._args.oper: self._vnc_lib = VncApi( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, "/", api_server_use_ssl=self._args.api_server_use_ssl, ) # Update global system config also with this ASN gsc_obj = self._vnc_lib.global_system_config_read(fq_name=["default-global-system-config"]) gsc_obj.set_autonomous_system(self._args.router_asn) if self._args.ibgp_auto_mesh is not None: gsc_obj.set_ibgp_auto_mesh(self._args.ibgp_auto_mesh) if self._args.set_graceful_restart_parameters == True: gr_params = GracefulRestartParametersType() gr_params.set_restart_time(int(self._args.graceful_restart_time)) gr_params.set_long_lived_restart_time(int(self._args.long_lived_graceful_restart_time)) gr_params.set_end_of_rib_timeout(int(self._args.end_of_rib_timeout)) gr_params.set_enable(self._args.graceful_restart_enable) gr_params.set_bgp_helper_enable(self._args.graceful_restart_bgp_helper_enable) gr_params.set_xmpp_helper_enable(self._args.graceful_restart_xmpp_helper_enable) gsc_obj.set_graceful_restart_parameters(gr_params) self._vnc_lib.global_system_config_update(gsc_obj) return bp_obj = BgpProvisioner( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, api_server_use_ssl=self._args.api_server_use_ssl, ) if self._args.oper == "add": bp_obj.add_bgp_router( "control-node", self._args.host_name, self._args.host_ip, self._args.router_asn, self._args.address_families, self._args.md5, ) elif self._args.oper == "del": bp_obj.del_bgp_router(self._args.host_name) else: print "Unknown operation %s. Only 'add' and 'del' supported" % (self._args.oper)
def __init__(self, args_str = None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) bp_obj = BgpProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) bp_obj.add_route_target(self._args.routing_instance_name.split(':'), self._args.router_asn, self._args.route_target_number)
def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if self._args.router_asn and not self._args.oper: self._vnc_lib = VncApi( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, '/') # Update global system config also with this ASN gsc_obj = self._vnc_lib.global_system_config_read( fq_name=['default-global-system-config']) gsc_obj.set_autonomous_system(self._args.router_asn) if self._args.ibgp_auto_mesh is not None: gsc_obj.set_ibgp_auto_mesh(self._args.ibgp_auto_mesh) gr_params = GracefulRestartType() gr_update = False if self._args.graceful_restart_time: gr_params.set_graceful_restart_time( int(self._args.graceful_restart_time)) gr_update = True if self._args.long_lived_graceful_restart_time: gr_params.set_long_lived_graceful_restart_time( int(self._args.long_lived_graceful_restart_time)) gr_update = True if self._args.end_of_rib_receive_time: gr_params.set_end_of_rib_receive_time( int(self._args.end_of_rib_receive_time)) gr_update = True if gr_update: gsc_obj.set_graceful_restart_params(gr_params) self._vnc_lib.global_system_config_update(gsc_obj) return bp_obj = BgpProvisioner( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) if self._args.oper == 'add': bp_obj.add_bgp_router('contrail', self._args.host_name, self._args.host_ip, self._args.router_asn, self._args.address_families, self._args.md5) elif self._args.oper == 'del': bp_obj.del_bgp_router(self._args.host_name) else: print "Unknown operation %s. Only 'add' and 'del' supported"\ % (self._args.oper)
def __init__(self, args_str = None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) bp_obj = BgpProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) if self._args.oper == 'add': bp_obj.add_bgp_router('mx', self._args.router_name, self._args.router_ip, self._args.router_asn) elif self._args.oper == 'del': bp_obj.del_bgp_router(self._args.router_name) else: print "Unknown operation %s. Only 'add' and 'del' supported" %(self._args.oper)
def add_bgp_router(self): bp_obj = BgpProvisioner( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, self._args.api_server_use_ssl, self._args.use_admin_api, peer_list=peer_list, sub_cluster_name=self._args.sub_cluster_name) if self._args.oper == 'add': bp_obj.add_bgp_router('router', self._args.router_name, self._args.router_ip, self._args.router_asn, self._args.address_families) elif self._args.oper == 'del': bp_obj.del_bgp_router(self._args.router_name) else: print "Unknown operation %s. Only 'add' and 'del' supported"\ % (self._args.oper)
def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if self._args.router_asn and not self._args.oper: self._vnc_lib = VncApi(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, '/') # Update global system config also with this ASN gsc_obj = self._vnc_lib.global_system_config_read( fq_name=['default-global-system-config']) gsc_obj.set_autonomous_system(self._args.router_asn) self._vnc_lib.global_system_config_update(gsc_obj) return bp_obj = BgpProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) if self._args.oper == 'add': bp_obj.add_bgp_router('contrail', self._args.host_name, self._args.host_ip, self._args.router_asn) elif self._args.oper == 'del': bp_obj.del_bgp_router(self._args.host_name) else: print "Unknown operation %s. Only 'add' and 'del' supported"\ % (self._args.oper)
def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if self._args.router_asn and not self._args.oper: self._vnc_lib = VncApiAdmin( self._args.use_admin_api, self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, '/', api_server_use_ssl=self._args.api_server_use_ssl) # Update global system config also with this ASN gsc_obj = self._vnc_lib.global_system_config_read( fq_name=['default-global-system-config']) gsc_obj.set_autonomous_system(self._args.router_asn) if self._args.ibgp_auto_mesh is not None: gsc_obj.set_ibgp_auto_mesh(self._args.ibgp_auto_mesh) if self._args.set_graceful_restart_parameters == True: gr_params = GracefulRestartParametersType() gr_params.set_restart_time( int(self._args.graceful_restart_time)) gr_params.set_long_lived_restart_time( int(self._args.long_lived_graceful_restart_time)) gr_params.set_end_of_rib_timeout( int(self._args.end_of_rib_timeout)) gr_params.set_enable(self._args.graceful_restart_enable) gr_params.set_bgp_helper_enable( self._args.graceful_restart_bgp_helper_enable) gr_params.set_xmpp_helper_enable( self._args.graceful_restart_xmpp_helper_enable) gsc_obj.set_graceful_restart_parameters(gr_params) self._vnc_lib.global_system_config_update(gsc_obj) return bp_obj = BgpProvisioner( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, api_server_use_ssl=self._args.api_server_use_ssl, use_admin_api=self._args.use_admin_api) if self._args.oper == 'add': bp_obj.add_bgp_router('control-node', self._args.host_name, self._args.host_ip, self._args.router_asn, self._args.address_families, self._args.md5, self._args.local_autonomous_system) elif self._args.oper == 'del': bp_obj.del_bgp_router(self._args.host_name) else: print "Unknown operation %s. Only 'add' and 'del' supported"\ % (self._args.oper)
def __init__(self, args_str=None): self._args = None if not args_str: args_str = " ".join(sys.argv[1:]) self._parse_args(args_str) if self._args.router_asn and not self._args.oper: self._vnc_lib = VncApi( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, "/", ) # Update global system config also with this ASN gsc_obj = self._vnc_lib.global_system_config_read(fq_name=["default-global-system-config"]) gsc_obj.set_autonomous_system(self._args.router_asn) if self._args.ibgp_auto_mesh is not None: gsc_obj.set_ibgp_auto_mesh(self._args.ibgp_auto_mesh) self._vnc_lib.global_system_config_update(gsc_obj) return bp_obj = BgpProvisioner( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, ) if self._args.oper == "add": bp_obj.add_bgp_router( "contrail", self._args.host_name, self._args.host_ip, self._args.router_asn, self._args.md5 ) elif self._args.oper == "del": bp_obj.del_bgp_router(self._args.host_name) else: print "Unknown operation %s. Only 'add' and 'del' supported" % (self._args.oper)
def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) bp_obj = BgpProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port) if self._args.oper == 'add': bp_obj.add_bgp_router('mx', self._args.router_name, self._args.router_ip, self._args.router_asn) elif self._args.oper == 'del': bp_obj.del_bgp_router(self._args.router_name) else: print "Unknown operation %s. Only 'add' and 'del' supported"\ % (self._args.oper)
def add_bgp_router(self): bp_obj = BgpProvisioner(self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, self._args.api_server_use_ssl, self._args.use_admin_api, peer_list=self._peer_list, sub_cluster_name=self._args.sub_cluster_name) if self._args.oper == 'add': bp_obj.add_bgp_router('router', self._args.router_name, self._args.router_ip, self._args.router_asn, self._args.address_families) elif self._args.oper == 'del': bp_obj.del_bgp_router(self._args.router_name) else: print("Unknown operation %s. Only 'add' and 'del' supported"\ % (self._args.oper))
def __init__(self, args_str=None): self._args = None if not args_str: args_str = ' '.join(sys.argv[1:]) self._parse_args(args_str) if self._args.peer_list: peer_list = self._args.peer_list.split(',') else: peer_list = None if self._args.router_asn and not self._args.oper: self._vnc_lib = VncApiAdmin( self._args.use_admin_api, self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, '/', api_server_use_ssl=self._args.api_server_use_ssl) # Update global system config also with this ASN gsc_obj = self._vnc_lib.global_system_config_read( fq_name=['default-global-system-config']) gsc_obj.set_autonomous_system(self._args.router_asn) if self._args.ibgp_auto_mesh is not None: gsc_obj.set_ibgp_auto_mesh(self._args.ibgp_auto_mesh) if self._args.set_graceful_restart_parameters == True: gr_params = GracefulRestartParametersType() gr_params.set_restart_time( int(self._args.graceful_restart_time)) gr_params.set_long_lived_restart_time( int(self._args.long_lived_graceful_restart_time)) gr_params.set_end_of_rib_timeout( int(self._args.end_of_rib_timeout)) gr_params.set_enable(self._args.graceful_restart_enable) gr_params.set_bgp_helper_enable( self._args.graceful_restart_bgp_helper_enable) gr_params.set_xmpp_helper_enable( self._args.graceful_restart_xmpp_helper_enable) gsc_obj.set_graceful_restart_parameters(gr_params) self._vnc_lib.global_system_config_update(gsc_obj) return bp_obj = BgpProvisioner( self._args.admin_user, self._args.admin_password, self._args.admin_tenant_name, self._args.api_server_ip, self._args.api_server_port, api_server_use_ssl=self._args.api_server_use_ssl, use_admin_api=self._args.use_admin_api, sub_cluster_name=self._args.sub_cluster_name, peer_list=peer_list) if self._args.oper == 'add': if self._args.sub_cluster_name: bp_obj.add_bgp_router('external-control-node', self._args.host_name, self._args.host_ip, self._args.router_asn, self._args.address_families, self._args.md5, self._args.local_autonomous_system, self._args.bgp_server_port) else: bp_obj.add_bgp_router('control-node', self._args.host_name, self._args.host_ip, self._args.router_asn, self._args.address_families, self._args.md5, self._args.local_autonomous_system, self._args.bgp_server_port) elif self._args.oper == 'del': bp_obj.del_bgp_router(self._args.host_name) else: print "Unknown operation %s. Only 'add' and 'del' supported"\ % (self._args.oper)
def take_action(self, parsed_args): self.app.stdout.write('Option to delete bgp router\n') args_str = ' '.join(parsed_args[1:]) sys.argv = parsed_args p = BgpProvisioner(args_str) p.delete_bgp_router()