repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
openstack/networking-cisco
networking_cisco/plugins/cisco/db/l3/ha_db.py
HA_db_mixin._add_redundancy_router_interfaces
def _add_redundancy_router_interfaces(self, context, router, itfc_info, new_port, redundancy_router_ids=None, ha_settings_db=None, create_ha_group=True): """To be called in add_router_in...
python
def _add_redundancy_router_interfaces(self, context, router, itfc_info, new_port, redundancy_router_ids=None, ha_settings_db=None, create_ha_group=True): """To be called in add_router_in...
[ "def", "_add_redundancy_router_interfaces", "(", "self", ",", "context", ",", "router", ",", "itfc_info", ",", "new_port", ",", "redundancy_router_ids", "=", "None", ",", "ha_settings_db", "=", "None", ",", "create_ha_group", "=", "True", ")", ":", "# There are es...
To be called in add_router_interface() AFTER interface has been added to router in DB.
[ "To", "be", "called", "in", "add_router_interface", "()", "AFTER", "interface", "has", "been", "added", "to", "router", "in", "DB", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L552-L630
openstack/networking-cisco
networking_cisco/plugins/cisco/db/l3/ha_db.py
HA_db_mixin._update_redundancy_router_interfaces
def _update_redundancy_router_interfaces(self, context, router, port, modified_port_data, redundancy_router_ids=None, ha_settings_db=None): """To be called when the router inter...
python
def _update_redundancy_router_interfaces(self, context, router, port, modified_port_data, redundancy_router_ids=None, ha_settings_db=None): """To be called when the router inter...
[ "def", "_update_redundancy_router_interfaces", "(", "self", ",", "context", ",", "router", ",", "port", ",", "modified_port_data", ",", "redundancy_router_ids", "=", "None", ",", "ha_settings_db", "=", "None", ")", ":", "router_id", "=", "router", "[", "'id'", "...
To be called when the router interfaces are updated, like in the case of change in port admin_state_up status
[ "To", "be", "called", "when", "the", "router", "interfaces", "are", "updated", "like", "in", "the", "case", "of", "change", "in", "port", "admin_state_up", "status" ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L632-L655
openstack/networking-cisco
networking_cisco/plugins/cisco/db/l3/ha_db.py
HA_db_mixin._remove_redundancy_router_interfaces
def _remove_redundancy_router_interfaces(self, context, router_id, old_port): """To be called in delete_router_interface() BEFORE interface has been removed from router in DB. """ ha_settings = self._get_ha_settings_by_router_id(context, route...
python
def _remove_redundancy_router_interfaces(self, context, router_id, old_port): """To be called in delete_router_interface() BEFORE interface has been removed from router in DB. """ ha_settings = self._get_ha_settings_by_router_id(context, route...
[ "def", "_remove_redundancy_router_interfaces", "(", "self", ",", "context", ",", "router_id", ",", "old_port", ")", ":", "ha_settings", "=", "self", ".", "_get_ha_settings_by_router_id", "(", "context", ",", "router_id", ")", "if", "ha_settings", "is", "None", "or...
To be called in delete_router_interface() BEFORE interface has been removed from router in DB.
[ "To", "be", "called", "in", "delete_router_interface", "()", "BEFORE", "interface", "has", "been", "removed", "from", "router", "in", "DB", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L710-L730
openstack/networking-cisco
networking_cisco/plugins/cisco/db/l3/ha_db.py
HA_db_mixin._redundancy_routers_for_floatingip
def _redundancy_routers_for_floatingip( self, context, router_id, redundancy_router_ids=None, ha_settings_db=None): """To be called in update_floatingip() to get the redundant router ids. """ if ha_settings_db is None: ha_settings_db = self._get_ha...
python
def _redundancy_routers_for_floatingip( self, context, router_id, redundancy_router_ids=None, ha_settings_db=None): """To be called in update_floatingip() to get the redundant router ids. """ if ha_settings_db is None: ha_settings_db = self._get_ha...
[ "def", "_redundancy_routers_for_floatingip", "(", "self", ",", "context", ",", "router_id", ",", "redundancy_router_ids", "=", "None", ",", "ha_settings_db", "=", "None", ")", ":", "if", "ha_settings_db", "is", "None", ":", "ha_settings_db", "=", "self", ".", "_...
To be called in update_floatingip() to get the redundant router ids.
[ "To", "be", "called", "in", "update_floatingip", "()", "to", "get", "the", "redundant", "router", "ids", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L732-L750
openstack/networking-cisco
networking_cisco/plugins/cisco/db/l3/ha_db.py
HA_db_mixin._populate_ha_information
def _populate_ha_information(self, context, router): """To be called when router information, including router interface list, (for the l3_cfg_agent) has been collected so it is extended with ha information. """ r_r_b = self._get_redundancy_router_bindings( context, r...
python
def _populate_ha_information(self, context, router): """To be called when router information, including router interface list, (for the l3_cfg_agent) has been collected so it is extended with ha information. """ r_r_b = self._get_redundancy_router_bindings( context, r...
[ "def", "_populate_ha_information", "(", "self", ",", "context", ",", "router", ")", ":", "r_r_b", "=", "self", ".", "_get_redundancy_router_bindings", "(", "context", ",", "redundancy_router_id", "=", "router", "[", "'id'", "]", ")", "if", "not", "r_r_b", ":",...
To be called when router information, including router interface list, (for the l3_cfg_agent) has been collected so it is extended with ha information.
[ "To", "be", "called", "when", "router", "information", "including", "router", "interface", "list", "(", "for", "the", "l3_cfg_agent", ")", "has", "been", "collected", "so", "it", "is", "extended", "with", "ha", "information", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L799-L859
openstack/networking-cisco
networking_cisco/plugins/cisco/db/l3/ha_db.py
HA_db_mixin._create_hidden_port
def _create_hidden_port(self, context, network_id, device_id, fixed_ips, port_type=DEVICE_OWNER_ROUTER_INTF): """Creates port used specially for HA purposes.""" port = {'port': { 'tenant_id': '', # intentionally not set 'network_id': network_id, ...
python
def _create_hidden_port(self, context, network_id, device_id, fixed_ips, port_type=DEVICE_OWNER_ROUTER_INTF): """Creates port used specially for HA purposes.""" port = {'port': { 'tenant_id': '', # intentionally not set 'network_id': network_id, ...
[ "def", "_create_hidden_port", "(", "self", ",", "context", ",", "network_id", ",", "device_id", ",", "fixed_ips", ",", "port_type", "=", "DEVICE_OWNER_ROUTER_INTF", ")", ":", "port", "=", "{", "'port'", ":", "{", "'tenant_id'", ":", "''", ",", "# intentionally...
Creates port used specially for HA purposes.
[ "Creates", "port", "used", "specially", "for", "HA", "purposes", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L936-L952
openstack/networking-cisco
networking_cisco/plugins/cisco/db/l3/ha_db.py
HA_db_mixin.get_router_for_floatingip
def get_router_for_floatingip(self, context, internal_port, internal_subnet, external_network_id): """We need to over-load this function so that we only return the user visible router and never its redundancy routers (as they never have floatingips associated wi...
python
def get_router_for_floatingip(self, context, internal_port, internal_subnet, external_network_id): """We need to over-load this function so that we only return the user visible router and never its redundancy routers (as they never have floatingips associated wi...
[ "def", "get_router_for_floatingip", "(", "self", ",", "context", ",", "internal_port", ",", "internal_subnet", ",", "external_network_id", ")", ":", "gw_port", "=", "orm", ".", "aliased", "(", "models_v2", ".", "Port", ",", "name", "=", "\"gw_port\"", ")", "ro...
We need to over-load this function so that we only return the user visible router and never its redundancy routers (as they never have floatingips associated with them).
[ "We", "need", "to", "over", "-", "load", "this", "function", "so", "that", "we", "only", "return", "the", "user", "visible", "router", "and", "never", "its", "redundancy", "routers", "(", "as", "they", "never", "have", "floatingips", "associated", "with", ...
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L1020-L1062
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
MaxSched.allocate_fw_dev
def allocate_fw_dev(self, fw_id): """Allocate firewall device. Allocate the first Firewall device which has resources available. """ for cnt in self.res: used = self.res.get(cnt).get('used') if used < self.res.get(cnt).get('quota'): self.res[cnt][...
python
def allocate_fw_dev(self, fw_id): """Allocate firewall device. Allocate the first Firewall device which has resources available. """ for cnt in self.res: used = self.res.get(cnt).get('used') if used < self.res.get(cnt).get('quota'): self.res[cnt][...
[ "def", "allocate_fw_dev", "(", "self", ",", "fw_id", ")", ":", "for", "cnt", "in", "self", ".", "res", ":", "used", "=", "self", ".", "res", ".", "get", "(", "cnt", ")", ".", "get", "(", "'used'", ")", "if", "used", "<", "self", ".", "res", "."...
Allocate firewall device. Allocate the first Firewall device which has resources available.
[ "Allocate", "firewall", "device", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L51-L63
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
MaxSched.populate_fw_dev
def populate_fw_dev(self, fw_id, mgmt_ip, new): """Populate the class after a restart. """ for cnt in self.res: used = self.res.get(cnt).get('used') if mgmt_ip == self.res[cnt].get('mgmt_ip'): if new: self.res[cnt]['used'] = used + 1 ...
python
def populate_fw_dev(self, fw_id, mgmt_ip, new): """Populate the class after a restart. """ for cnt in self.res: used = self.res.get(cnt).get('used') if mgmt_ip == self.res[cnt].get('mgmt_ip'): if new: self.res[cnt]['used'] = used + 1 ...
[ "def", "populate_fw_dev", "(", "self", ",", "fw_id", ",", "mgmt_ip", ",", "new", ")", ":", "for", "cnt", "in", "self", ".", "res", ":", "used", "=", "self", ".", "res", ".", "get", "(", "cnt", ")", ".", "get", "(", "'used'", ")", "if", "mgmt_ip",...
Populate the class after a restart.
[ "Populate", "the", "class", "after", "a", "restart", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L65-L75
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
MaxSched.get_fw_dev_map
def get_fw_dev_map(self, fw_id): """Return the object dict and mgmt ip for a firewall. """ for cnt in self.res: if fw_id in self.res.get(cnt).get('fw_id_lst'): return self.res[cnt].get('obj_dict'), ( self.res[cnt].get('mgmt_ip')) return None, None
python
def get_fw_dev_map(self, fw_id): """Return the object dict and mgmt ip for a firewall. """ for cnt in self.res: if fw_id in self.res.get(cnt).get('fw_id_lst'): return self.res[cnt].get('obj_dict'), ( self.res[cnt].get('mgmt_ip')) return None, None
[ "def", "get_fw_dev_map", "(", "self", ",", "fw_id", ")", ":", "for", "cnt", "in", "self", ".", "res", ":", "if", "fw_id", "in", "self", ".", "res", ".", "get", "(", "cnt", ")", ".", "get", "(", "'fw_id_lst'", ")", ":", "return", "self", ".", "res...
Return the object dict and mgmt ip for a firewall.
[ "Return", "the", "object", "dict", "and", "mgmt", "ip", "for", "a", "firewall", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L77-L83
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
MaxSched.deallocate_fw_dev
def deallocate_fw_dev(self, fw_id): """Release the firewall resource. """ for cnt in self.res: if fw_id in self.res.get(cnt).get('fw_id_lst'): self.res[cnt]['used'] = self.res[cnt]['used'] - 1 self.res.get(cnt).get('fw_id_lst').remove(fw_id) re...
python
def deallocate_fw_dev(self, fw_id): """Release the firewall resource. """ for cnt in self.res: if fw_id in self.res.get(cnt).get('fw_id_lst'): self.res[cnt]['used'] = self.res[cnt]['used'] - 1 self.res.get(cnt).get('fw_id_lst').remove(fw_id) re...
[ "def", "deallocate_fw_dev", "(", "self", ",", "fw_id", ")", ":", "for", "cnt", "in", "self", ".", "res", ":", "if", "fw_id", "in", "self", ".", "res", ".", "get", "(", "cnt", ")", ".", "get", "(", "'fw_id_lst'", ")", ":", "self", ".", "res", "[",...
Release the firewall resource.
[ "Release", "the", "firewall", "resource", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L85-L91
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.populate_local_sch_cache
def populate_local_sch_cache(self, fw_dict): """Populate the local cache from FW DB after restart. """ for fw_id in fw_dict: fw_data = fw_dict.get(fw_id) mgmt_ip = fw_data.get('fw_mgmt_ip') dev_status = fw_data.get('device_status') if dev_status == 'SUCCES...
python
def populate_local_sch_cache(self, fw_dict): """Populate the local cache from FW DB after restart. """ for fw_id in fw_dict: fw_data = fw_dict.get(fw_id) mgmt_ip = fw_data.get('fw_mgmt_ip') dev_status = fw_data.get('device_status') if dev_status == 'SUCCES...
[ "def", "populate_local_sch_cache", "(", "self", ",", "fw_dict", ")", ":", "for", "fw_id", "in", "fw_dict", ":", "fw_data", "=", "fw_dict", ".", "get", "(", "fw_id", ")", "mgmt_ip", "=", "fw_data", ".", "get", "(", "'fw_mgmt_ip'", ")", "dev_status", "=", ...
Populate the local cache from FW DB after restart.
[ "Populate", "the", "local", "cache", "from", "FW", "DB", "after", "restart", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L132-L148
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.drvr_initialize
def drvr_initialize(self, cfg): """Initialize the driver routines. """ cnt = 0 for ip in self.obj_dict: cfg_dict = {} drvr_obj = self.obj_dict.get(ip).get('drvr_obj') cfg_dict['mgmt_ip_addr'] = ip if self.user_list is not None: cfg_...
python
def drvr_initialize(self, cfg): """Initialize the driver routines. """ cnt = 0 for ip in self.obj_dict: cfg_dict = {} drvr_obj = self.obj_dict.get(ip).get('drvr_obj') cfg_dict['mgmt_ip_addr'] = ip if self.user_list is not None: cfg_...
[ "def", "drvr_initialize", "(", "self", ",", "cfg", ")", ":", "cnt", "=", "0", "for", "ip", "in", "self", ".", "obj_dict", ":", "cfg_dict", "=", "{", "}", "drvr_obj", "=", "self", ".", "obj_dict", ".", "get", "(", "ip", ")", ".", "get", "(", "'drv...
Initialize the driver routines.
[ "Initialize", "the", "driver", "routines", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L150-L166
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.populate_event_que
def populate_event_que(self, que_obj): """Populates the event queue object. This is for sending router events to event handler. """ for ip in self.obj_dict: drvr_obj = self.obj_dict.get(ip).get('drvr_obj') drvr_obj.populate_event_que(que_obj)
python
def populate_event_que(self, que_obj): """Populates the event queue object. This is for sending router events to event handler. """ for ip in self.obj_dict: drvr_obj = self.obj_dict.get(ip).get('drvr_obj') drvr_obj.populate_event_que(que_obj)
[ "def", "populate_event_que", "(", "self", ",", "que_obj", ")", ":", "for", "ip", "in", "self", ".", "obj_dict", ":", "drvr_obj", "=", "self", ".", "obj_dict", ".", "get", "(", "ip", ")", ".", "get", "(", "'drvr_obj'", ")", "drvr_obj", ".", "populate_ev...
Populates the event queue object. This is for sending router events to event handler.
[ "Populates", "the", "event", "queue", "object", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L168-L175
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.populate_dcnm_obj
def populate_dcnm_obj(self, dcnm_obj): """Populates the DCNM object. """ for ip in self.obj_dict: drvr_obj = self.obj_dict.get(ip).get('drvr_obj') drvr_obj.populate_dcnm_obj(dcnm_obj)
python
def populate_dcnm_obj(self, dcnm_obj): """Populates the DCNM object. """ for ip in self.obj_dict: drvr_obj = self.obj_dict.get(ip).get('drvr_obj') drvr_obj.populate_dcnm_obj(dcnm_obj)
[ "def", "populate_dcnm_obj", "(", "self", ",", "dcnm_obj", ")", ":", "for", "ip", "in", "self", ".", "obj_dict", ":", "drvr_obj", "=", "self", ".", "obj_dict", ".", "get", "(", "ip", ")", ".", "get", "(", "'drvr_obj'", ")", "drvr_obj", ".", "populate_dc...
Populates the DCNM object.
[ "Populates", "the", "DCNM", "object", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L177-L181
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.is_device_virtual
def is_device_virtual(self): """Returns if the device is physical or virtual. """ for ip in self.obj_dict: drvr_obj = self.obj_dict.get(ip).get('drvr_obj') ret = drvr_obj.is_device_virtual() # No way to pin a device as of now, so return the first # TODO(pa...
python
def is_device_virtual(self): """Returns if the device is physical or virtual. """ for ip in self.obj_dict: drvr_obj = self.obj_dict.get(ip).get('drvr_obj') ret = drvr_obj.is_device_virtual() # No way to pin a device as of now, so return the first # TODO(pa...
[ "def", "is_device_virtual", "(", "self", ")", ":", "for", "ip", "in", "self", ".", "obj_dict", ":", "drvr_obj", "=", "self", ".", "obj_dict", ".", "get", "(", "ip", ")", ".", "get", "(", "'drvr_obj'", ")", "ret", "=", "drvr_obj", ".", "is_device_virtua...
Returns if the device is physical or virtual.
[ "Returns", "if", "the", "device", "is", "physical", "or", "virtual", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L183-L190
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.create_fw_device
def create_fw_device(self, tenant_id, fw_id, data): """Creates the Firewall. """ drvr_dict, mgmt_ip = self.sched_obj.allocate_fw_dev(fw_id) if drvr_dict is not None and mgmt_ip is not None: self.update_fw_db_mgmt_ip(fw_id, mgmt_ip) ret = drvr_dict.get('drvr_obj').create_f...
python
def create_fw_device(self, tenant_id, fw_id, data): """Creates the Firewall. """ drvr_dict, mgmt_ip = self.sched_obj.allocate_fw_dev(fw_id) if drvr_dict is not None and mgmt_ip is not None: self.update_fw_db_mgmt_ip(fw_id, mgmt_ip) ret = drvr_dict.get('drvr_obj').create_f...
[ "def", "create_fw_device", "(", "self", ",", "tenant_id", ",", "fw_id", ",", "data", ")", ":", "drvr_dict", ",", "mgmt_ip", "=", "self", ".", "sched_obj", ".", "allocate_fw_dev", "(", "fw_id", ")", "if", "drvr_dict", "is", "not", "None", "and", "mgmt_ip", ...
Creates the Firewall.
[ "Creates", "the", "Firewall", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L192-L202
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.delete_fw_device
def delete_fw_device(self, tenant_id, fw_id, data): """Deletes the Firewall. """ drvr_dict, mgmt_ip = self.sched_obj.get_fw_dev_map(fw_id) ret = drvr_dict.get('drvr_obj').delete_fw(tenant_id, data) # FW DB gets deleted, so no need to remove the MGMT IP if ret: self.sc...
python
def delete_fw_device(self, tenant_id, fw_id, data): """Deletes the Firewall. """ drvr_dict, mgmt_ip = self.sched_obj.get_fw_dev_map(fw_id) ret = drvr_dict.get('drvr_obj').delete_fw(tenant_id, data) # FW DB gets deleted, so no need to remove the MGMT IP if ret: self.sc...
[ "def", "delete_fw_device", "(", "self", ",", "tenant_id", ",", "fw_id", ",", "data", ")", ":", "drvr_dict", ",", "mgmt_ip", "=", "self", ".", "sched_obj", ".", "get_fw_dev_map", "(", "fw_id", ")", "ret", "=", "drvr_dict", ".", "get", "(", "'drvr_obj'", "...
Deletes the Firewall.
[ "Deletes", "the", "Firewall", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L204-L211
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.modify_fw_device
def modify_fw_device(self, tenant_id, fw_id, data): """Modifies the firewall cfg. """ drvr_dict, mgmt_ip = self.sched_obj.get_fw_dev_map(fw_id) return drvr_dict.get('drvr_obj').modify_fw(tenant_id, data)
python
def modify_fw_device(self, tenant_id, fw_id, data): """Modifies the firewall cfg. """ drvr_dict, mgmt_ip = self.sched_obj.get_fw_dev_map(fw_id) return drvr_dict.get('drvr_obj').modify_fw(tenant_id, data)
[ "def", "modify_fw_device", "(", "self", ",", "tenant_id", ",", "fw_id", ",", "data", ")", ":", "drvr_dict", ",", "mgmt_ip", "=", "self", ".", "sched_obj", ".", "get_fw_dev_map", "(", "fw_id", ")", "return", "drvr_dict", ".", "get", "(", "'drvr_obj'", ")", ...
Modifies the firewall cfg.
[ "Modifies", "the", "firewall", "cfg", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L213-L216
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.network_create_notif
def network_create_notif(self, tenant_id, tenant_name, cidr): """Notification for Network create. Since FW ID not present, it's not possible to know which FW instance to call. So, calling everyone, each instance will figure out if it applies to them. """ for ip in self.o...
python
def network_create_notif(self, tenant_id, tenant_name, cidr): """Notification for Network create. Since FW ID not present, it's not possible to know which FW instance to call. So, calling everyone, each instance will figure out if it applies to them. """ for ip in self.o...
[ "def", "network_create_notif", "(", "self", ",", "tenant_id", ",", "tenant_name", ",", "cidr", ")", ":", "for", "ip", "in", "self", ".", "obj_dict", ":", "drvr_obj", "=", "self", ".", "obj_dict", ".", "get", "(", "ip", ")", ".", "get", "(", "'drvr_obj'...
Notification for Network create. Since FW ID not present, it's not possible to know which FW instance to call. So, calling everyone, each instance will figure out if it applies to them.
[ "Notification", "for", "Network", "create", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L218-L229
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py
DeviceMgr.network_delete_notif
def network_delete_notif(self, tenant_id, tenant_name, net_id): """Notification for Network delete. Since FW ID not present, it's not possible to know which FW instance to call. So, calling everyone, each instance will figure out if it applies to them. """ for ip in self...
python
def network_delete_notif(self, tenant_id, tenant_name, net_id): """Notification for Network delete. Since FW ID not present, it's not possible to know which FW instance to call. So, calling everyone, each instance will figure out if it applies to them. """ for ip in self...
[ "def", "network_delete_notif", "(", "self", ",", "tenant_id", ",", "tenant_name", ",", "net_id", ")", ":", "for", "ip", "in", "self", ".", "obj_dict", ":", "drvr_obj", "=", "self", ".", "obj_dict", ".", "get", "(", "ip", ")", ".", "get", "(", "'drvr_ob...
Notification for Network delete. Since FW ID not present, it's not possible to know which FW instance to call. So, calling everyone, each instance will figure out if it applies to them.
[ "Notification", "for", "Network", "delete", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/drivers/dev_mgr.py#L231-L243
openstack/networking-cisco
networking_cisco/plugins/cisco/l3/rpc/l3_router_cfg_agent_rpc_cb.py
L3RouterCfgRpcCallback.get_cfg_router_ids
def get_cfg_router_ids(self, context, host, router_ids=None, hosting_device_ids=None): """Returns IDs of routers scheduled to l3 agent on <host>""" return self._l3plugin.cfg_list_router_ids_on_host(context, host, router_ids, ...
python
def get_cfg_router_ids(self, context, host, router_ids=None, hosting_device_ids=None): """Returns IDs of routers scheduled to l3 agent on <host>""" return self._l3plugin.cfg_list_router_ids_on_host(context, host, router_ids, ...
[ "def", "get_cfg_router_ids", "(", "self", ",", "context", ",", "host", ",", "router_ids", "=", "None", ",", "hosting_device_ids", "=", "None", ")", ":", "return", "self", ".", "_l3plugin", ".", "cfg_list_router_ids_on_host", "(", "context", ",", "host", ",", ...
Returns IDs of routers scheduled to l3 agent on <host>
[ "Returns", "IDs", "of", "routers", "scheduled", "to", "l3", "agent", "on", "<host", ">" ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_cfg_agent_rpc_cb.py#L38-L43
openstack/networking-cisco
networking_cisco/plugins/cisco/l3/rpc/l3_router_cfg_agent_rpc_cb.py
L3RouterCfgRpcCallback.cfg_sync_routers
def cfg_sync_routers(self, context, host, router_ids=None, hosting_device_ids=None): """Sync routers according to filters to a specific Cisco cfg agent. :param context: contains user information :param host: originator of callback :param router_ids: list of rout...
python
def cfg_sync_routers(self, context, host, router_ids=None, hosting_device_ids=None): """Sync routers according to filters to a specific Cisco cfg agent. :param context: contains user information :param host: originator of callback :param router_ids: list of rout...
[ "def", "cfg_sync_routers", "(", "self", ",", "context", ",", "host", ",", "router_ids", "=", "None", ",", "hosting_device_ids", "=", "None", ")", ":", "adm_context", "=", "bc", ".", "context", ".", "get_admin_context", "(", ")", "try", ":", "routers", "=",...
Sync routers according to filters to a specific Cisco cfg agent. :param context: contains user information :param host: originator of callback :param router_ids: list of router ids to return information about :param hosting_device_ids: list of hosting device ids to get route...
[ "Sync", "routers", "according", "to", "filters", "to", "a", "specific", "Cisco", "cfg", "agent", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_cfg_agent_rpc_cb.py#L47-L68
openstack/networking-cisco
networking_cisco/plugins/cisco/l3/rpc/l3_router_cfg_agent_rpc_cb.py
L3RouterCfgRpcCallback.update_floatingip_statuses_cfg
def update_floatingip_statuses_cfg(self, context, router_id, fip_statuses): """Update operational status for one or several floating IPs. This is called by Cisco cfg agent to update the status of one or several floatingips. :param context: contains user information :param route...
python
def update_floatingip_statuses_cfg(self, context, router_id, fip_statuses): """Update operational status for one or several floating IPs. This is called by Cisco cfg agent to update the status of one or several floatingips. :param context: contains user information :param route...
[ "def", "update_floatingip_statuses_cfg", "(", "self", ",", "context", ",", "router_id", ",", "fip_statuses", ")", ":", "with", "context", ".", "session", ".", "begin", "(", "subtransactions", "=", "True", ")", ":", "for", "(", "floatingip_id", ",", "status", ...
Update operational status for one or several floating IPs. This is called by Cisco cfg agent to update the status of one or several floatingips. :param context: contains user information :param router_id: id of router associated with the floatingips :param router_id: dict with ...
[ "Update", "operational", "status", "for", "one", "or", "several", "floating", "IPs", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_cfg_agent_rpc_cb.py#L112-L145
openstack/networking-cisco
networking_cisco/plugins/cisco/l3/rpc/l3_router_cfg_agent_rpc_cb.py
L3RouterCfgRpcCallback.update_port_statuses_cfg
def update_port_statuses_cfg(self, context, port_ids, status): """Update the operational statuses of a list of router ports. This is called by the Cisco cfg agent to update the status of a list of ports. :param context: contains user information :param port_ids: list of ids of ...
python
def update_port_statuses_cfg(self, context, port_ids, status): """Update the operational statuses of a list of router ports. This is called by the Cisco cfg agent to update the status of a list of ports. :param context: contains user information :param port_ids: list of ids of ...
[ "def", "update_port_statuses_cfg", "(", "self", ",", "context", ",", "port_ids", ",", "status", ")", ":", "self", ".", "_l3plugin", ".", "update_router_port_statuses", "(", "context", ",", "port_ids", ",", "status", ")" ]
Update the operational statuses of a list of router ports. This is called by the Cisco cfg agent to update the status of a list of ports. :param context: contains user information :param port_ids: list of ids of all the ports for the given status :param status: PORT_STATUS_ACTI...
[ "Update", "the", "operational", "statuses", "of", "a", "list", "of", "router", "ports", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/l3/rpc/l3_router_cfg_agent_rpc_cb.py#L148-L159
openstack/networking-cisco
tools/saf_prepare_setup.py
get_mysql_credentials
def get_mysql_credentials(cfg_file): """Get the credentials and database name from options in config file.""" try: parser = ConfigParser.ConfigParser() cfg_fp = open(cfg_file) parser.readfp(cfg_fp) cfg_fp.close() except ConfigParser.NoOptionError: cfg_fp.close() ...
python
def get_mysql_credentials(cfg_file): """Get the credentials and database name from options in config file.""" try: parser = ConfigParser.ConfigParser() cfg_fp = open(cfg_file) parser.readfp(cfg_fp) cfg_fp.close() except ConfigParser.NoOptionError: cfg_fp.close() ...
[ "def", "get_mysql_credentials", "(", "cfg_file", ")", ":", "try", ":", "parser", "=", "ConfigParser", ".", "ConfigParser", "(", ")", "cfg_fp", "=", "open", "(", "cfg_file", ")", "parser", ".", "readfp", "(", "cfg_fp", ")", "cfg_fp", ".", "close", "(", ")...
Get the credentials and database name from options in config file.
[ "Get", "the", "credentials", "and", "database", "name", "from", "options", "in", "config", "file", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/tools/saf_prepare_setup.py#L103-L148
openstack/networking-cisco
tools/saf_prepare_setup.py
modify_conf
def modify_conf(cfgfile, service_name, outfn): """Modify config file neutron and keystone to include enabler options.""" if not cfgfile or not outfn: print('ERROR: There is no config file.') sys.exit(0) options = service_options[service_name] with open(cfgfile, 'r') as cf: line...
python
def modify_conf(cfgfile, service_name, outfn): """Modify config file neutron and keystone to include enabler options.""" if not cfgfile or not outfn: print('ERROR: There is no config file.') sys.exit(0) options = service_options[service_name] with open(cfgfile, 'r') as cf: line...
[ "def", "modify_conf", "(", "cfgfile", ",", "service_name", ",", "outfn", ")", ":", "if", "not", "cfgfile", "or", "not", "outfn", ":", "print", "(", "'ERROR: There is no config file.'", ")", "sys", ".", "exit", "(", "0", ")", "options", "=", "service_options"...
Modify config file neutron and keystone to include enabler options.
[ "Modify", "config", "file", "neutron", "and", "keystone", "to", "include", "enabler", "options", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/tools/saf_prepare_setup.py#L151-L202
openstack/networking-cisco
networking_cisco/plugins/cisco/cfg_agent/device_drivers/asr1k/asr1k_auto_config_check.py
CiscoDevMgrRPC.get_all_hosting_devices
def get_all_hosting_devices(self, context): """Get a list of all hosting devices.""" cctxt = self.client.prepare() return cctxt.call(context, 'get_all_hosting_devices', host=self.host)
python
def get_all_hosting_devices(self, context): """Get a list of all hosting devices.""" cctxt = self.client.prepare() return cctxt.call(context, 'get_all_hosting_devices', host=self.host)
[ "def", "get_all_hosting_devices", "(", "self", ",", "context", ")", ":", "cctxt", "=", "self", ".", "client", ".", "prepare", "(", ")", "return", "cctxt", ".", "call", "(", "context", ",", "'get_all_hosting_devices'", ",", "host", "=", "self", ".", "host",...
Get a list of all hosting devices.
[ "Get", "a", "list", "of", "all", "hosting", "devices", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_drivers/asr1k/asr1k_auto_config_check.py#L46-L51
openstack/networking-cisco
networking_cisco/plugins/cisco/cfg_agent/device_drivers/asr1k/asr1k_auto_config_check.py
CiscoRoutingPluginRPC.get_all_hosted_routers
def get_all_hosted_routers(self, context): """Make a remote process call to retrieve the sync data for routers that have been scheduled to a hosting device. :param context: session context """ cctxt = self.client.prepare() return cctxt.call(context, 'cfg_sync_all_host...
python
def get_all_hosted_routers(self, context): """Make a remote process call to retrieve the sync data for routers that have been scheduled to a hosting device. :param context: session context """ cctxt = self.client.prepare() return cctxt.call(context, 'cfg_sync_all_host...
[ "def", "get_all_hosted_routers", "(", "self", ",", "context", ")", ":", "cctxt", "=", "self", ".", "client", ".", "prepare", "(", ")", "return", "cctxt", ".", "call", "(", "context", ",", "'cfg_sync_all_hosted_routers'", ",", "host", "=", "self", ".", "hos...
Make a remote process call to retrieve the sync data for routers that have been scheduled to a hosting device. :param context: session context
[ "Make", "a", "remote", "process", "call", "to", "retrieve", "the", "sync", "data", "for", "routers", "that", "have", "been", "scheduled", "to", "a", "hosting", "device", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_drivers/asr1k/asr1k_auto_config_check.py#L62-L70
openstack/networking-cisco
networking_cisco/plugins/cisco/cfg_agent/device_drivers/asr1k/asr1k_auto_config_check.py
CiscoRoutingPluginRPC.get_hardware_router_type_id
def get_hardware_router_type_id(self, context): """Get the ID for the ASR1k hardware router type.""" cctxt = self.client.prepare() return cctxt.call(context, 'get_hardware_router_type_id', host=self.host)
python
def get_hardware_router_type_id(self, context): """Get the ID for the ASR1k hardware router type.""" cctxt = self.client.prepare() return cctxt.call(context, 'get_hardware_router_type_id', host=self.host)
[ "def", "get_hardware_router_type_id", "(", "self", ",", "context", ")", ":", "cctxt", "=", "self", ".", "client", ".", "prepare", "(", ")", "return", "cctxt", ".", "call", "(", "context", ",", "'get_hardware_router_type_id'", ",", "host", "=", "self", ".", ...
Get the ID for the ASR1k hardware router type.
[ "Get", "the", "ID", "for", "the", "ASR1k", "hardware", "router", "type", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/device_drivers/asr1k/asr1k_auto_config_check.py#L72-L77
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
RpcCallBacks.heartbeat
def heartbeat(self, context, msg): """Process heartbeat message from agents on compute nodes.""" args = jsonutils.loads(msg) when = args.get('when') agent = args.get('agent') # The configurations in here, only used once when creating entry # for an agent in DB for the fi...
python
def heartbeat(self, context, msg): """Process heartbeat message from agents on compute nodes.""" args = jsonutils.loads(msg) when = args.get('when') agent = args.get('agent') # The configurations in here, only used once when creating entry # for an agent in DB for the fi...
[ "def", "heartbeat", "(", "self", ",", "context", ",", "msg", ")", ":", "args", "=", "jsonutils", ".", "loads", "(", "msg", ")", "when", "=", "args", ".", "get", "(", "'when'", ")", "agent", "=", "args", ".", "get", "(", "'agent'", ")", "# The confi...
Process heartbeat message from agents on compute nodes.
[ "Process", "heartbeat", "message", "from", "agents", "on", "compute", "nodes", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L69-L90
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
RpcCallBacks.request_uplink_info
def request_uplink_info(self, context, agent): """Process uplink message from an agent.""" LOG.debug('request_uplink_info from %(agent)s', {'agent': agent}) # Add the request into queue for processing. event_type = 'agent.request.uplink' payload = {'agent': agent} times...
python
def request_uplink_info(self, context, agent): """Process uplink message from an agent.""" LOG.debug('request_uplink_info from %(agent)s', {'agent': agent}) # Add the request into queue for processing. event_type = 'agent.request.uplink' payload = {'agent': agent} times...
[ "def", "request_uplink_info", "(", "self", ",", "context", ",", "agent", ")", ":", "LOG", ".", "debug", "(", "'request_uplink_info from %(agent)s'", ",", "{", "'agent'", ":", "agent", "}", ")", "# Add the request into queue for processing.", "event_type", "=", "'age...
Process uplink message from an agent.
[ "Process", "uplink", "message", "from", "an", "agent", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L92-L106
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
RpcCallBacks.set_static_ip_address
def set_static_ip_address(self, context, msg): """Process request for setting rules in iptables. In cases that static ip address is assigned for a VM, it is needed to update the iptables rule for that address. """ args = jsonutils.loads(msg) macaddr = args.get('mac') ...
python
def set_static_ip_address(self, context, msg): """Process request for setting rules in iptables. In cases that static ip address is assigned for a VM, it is needed to update the iptables rule for that address. """ args = jsonutils.loads(msg) macaddr = args.get('mac') ...
[ "def", "set_static_ip_address", "(", "self", ",", "context", ",", "msg", ")", ":", "args", "=", "jsonutils", ".", "loads", "(", "msg", ")", "macaddr", "=", "args", ".", "get", "(", "'mac'", ")", "ipaddr", "=", "args", ".", "get", "(", "'ip'", ")", ...
Process request for setting rules in iptables. In cases that static ip address is assigned for a VM, it is needed to update the iptables rule for that address.
[ "Process", "request", "for", "setting", "rules", "in", "iptables", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L199-L220
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
RpcCallBacks.update_vm_result
def update_vm_result(self, context, msg): """Update VM's result field in the DB. The result reflects the success of failure of operation when an agent processes the vm info. """ args = jsonutils.loads(msg) agent = context.get('agent') port_id = args.get('port_uui...
python
def update_vm_result(self, context, msg): """Update VM's result field in the DB. The result reflects the success of failure of operation when an agent processes the vm info. """ args = jsonutils.loads(msg) agent = context.get('agent') port_id = args.get('port_uui...
[ "def", "update_vm_result", "(", "self", ",", "context", ",", "msg", ")", ":", "args", "=", "jsonutils", ".", "loads", "(", "msg", ")", "agent", "=", "context", ".", "get", "(", "'agent'", ")", "port_id", "=", "args", ".", "get", "(", "'port_uuid'", "...
Update VM's result field in the DB. The result reflects the success of failure of operation when an agent processes the vm info.
[ "Update", "VM", "s", "result", "field", "in", "the", "DB", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L222-L247
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer._setup_rpc
def _setup_rpc(self): """Setup RPC server for dfa server.""" endpoints = RpcCallBacks(self) self.server = rpc.DfaRpcServer(self.ser_q, self._host, self.cfg.dfa_rpc.transport_url, endpoints, ...
python
def _setup_rpc(self): """Setup RPC server for dfa server.""" endpoints = RpcCallBacks(self) self.server = rpc.DfaRpcServer(self.ser_q, self._host, self.cfg.dfa_rpc.transport_url, endpoints, ...
[ "def", "_setup_rpc", "(", "self", ")", ":", "endpoints", "=", "RpcCallBacks", "(", "self", ")", "self", ".", "server", "=", "rpc", ".", "DfaRpcServer", "(", "self", ".", "ser_q", ",", "self", ".", "_host", ",", "self", ".", "cfg", ".", "dfa_rpc", "."...
Setup RPC server for dfa server.
[ "Setup", "RPC", "server", "for", "dfa", "server", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L406-L413
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.register_segment_dcnm
def register_segment_dcnm(self, cfg, seg_id_min, seg_id_max): """Register segmentation id pool with DCNM. """ orch_id = cfg.dcnm.orchestrator_id try: segid_range = self.dcnm_client.get_segmentid_range(orch_id) if segid_range is None: self.dcnm_client.set_...
python
def register_segment_dcnm(self, cfg, seg_id_min, seg_id_max): """Register segmentation id pool with DCNM. """ orch_id = cfg.dcnm.orchestrator_id try: segid_range = self.dcnm_client.get_segmentid_range(orch_id) if segid_range is None: self.dcnm_client.set_...
[ "def", "register_segment_dcnm", "(", "self", ",", "cfg", ",", "seg_id_min", ",", "seg_id_max", ")", ":", "orch_id", "=", "cfg", ".", "dcnm", ".", "orchestrator_id", "try", ":", "segid_range", "=", "self", ".", "dcnm_client", ".", "get_segmentid_range", "(", ...
Register segmentation id pool with DCNM.
[ "Register", "segmentation", "id", "pool", "with", "DCNM", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L426-L445
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.project_create_func
def project_create_func(self, proj_id, proj=None): """Create project given project uuid""" if self.get_project_name(proj_id): LOG.info("project %s exists, returning", proj_id) return if not proj: try: proj = self.keystone_event._service.proje...
python
def project_create_func(self, proj_id, proj=None): """Create project given project uuid""" if self.get_project_name(proj_id): LOG.info("project %s exists, returning", proj_id) return if not proj: try: proj = self.keystone_event._service.proje...
[ "def", "project_create_func", "(", "self", ",", "proj_id", ",", "proj", "=", "None", ")", ":", "if", "self", ".", "get_project_name", "(", "proj_id", ")", ":", "LOG", ".", "info", "(", "\"project %s exists, returning\"", ",", "proj_id", ")", "return", "if", ...
Create project given project uuid
[ "Create", "project", "given", "project", "uuid" ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L484-L528
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.project_create_event
def project_create_event(self, proj_info): """Create project.""" LOG.debug("Processing create %(proj)s event.", {'proj': proj_info}) proj_id = proj_info.get('resource_info') self.project_create_func(proj_id)
python
def project_create_event(self, proj_info): """Create project.""" LOG.debug("Processing create %(proj)s event.", {'proj': proj_info}) proj_id = proj_info.get('resource_info') self.project_create_func(proj_id)
[ "def", "project_create_event", "(", "self", ",", "proj_info", ")", ":", "LOG", ".", "debug", "(", "\"Processing create %(proj)s event.\"", ",", "{", "'proj'", ":", "proj_info", "}", ")", "proj_id", "=", "proj_info", ".", "get", "(", "'resource_info'", ")", "se...
Create project.
[ "Create", "project", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L530-L536
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.project_update_event
def project_update_event(self, proj_info): """Process project update event. There could be change in project name. DCNM doesn't allow change in project (a.k.a tenant). This event may be received for the DCI update. If the change is for DCI, update the DCI portion of the project name ...
python
def project_update_event(self, proj_info): """Process project update event. There could be change in project name. DCNM doesn't allow change in project (a.k.a tenant). This event may be received for the DCI update. If the change is for DCI, update the DCI portion of the project name ...
[ "def", "project_update_event", "(", "self", ",", "proj_info", ")", ":", "LOG", ".", "debug", "(", "\"Processing project_update_event %(proj)s.\"", ",", "{", "'proj'", ":", "proj_info", "}", ")", "proj_id", "=", "proj_info", ".", "get", "(", "'resource_info'", ")...
Process project update event. There could be change in project name. DCNM doesn't allow change in project (a.k.a tenant). This event may be received for the DCI update. If the change is for DCI, update the DCI portion of the project name and send the update event to the DCNM.
[ "Process", "project", "update", "event", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L538-L604
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.project_delete_event
def project_delete_event(self, proj_info): """Process project delete event.""" LOG.debug("Processing project_delete_event...") proj_id = proj_info.get('resource_info') proj_name = self.get_project_name(proj_id) if proj_name: try: self.dcnm_client.dele...
python
def project_delete_event(self, proj_info): """Process project delete event.""" LOG.debug("Processing project_delete_event...") proj_id = proj_info.get('resource_info') proj_name = self.get_project_name(proj_id) if proj_name: try: self.dcnm_client.dele...
[ "def", "project_delete_event", "(", "self", ",", "proj_info", ")", ":", "LOG", ".", "debug", "(", "\"Processing project_delete_event...\"", ")", "proj_id", "=", "proj_info", ".", "get", "(", "'resource_info'", ")", "proj_name", "=", "self", ".", "get_project_name"...
Process project delete event.
[ "Process", "project", "delete", "event", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L606-L628
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.subnet_create_event
def subnet_create_event(self, subnet_info): """Process subnet create event.""" subnet = subnet_info.get('subnet') if subnet: self.create_subnet(subnet) else: # Check whether request is for subnets. subnets = subnet_info.get('subnets') if s...
python
def subnet_create_event(self, subnet_info): """Process subnet create event.""" subnet = subnet_info.get('subnet') if subnet: self.create_subnet(subnet) else: # Check whether request is for subnets. subnets = subnet_info.get('subnets') if s...
[ "def", "subnet_create_event", "(", "self", ",", "subnet_info", ")", ":", "subnet", "=", "subnet_info", ".", "get", "(", "'subnet'", ")", "if", "subnet", ":", "self", ".", "create_subnet", "(", "subnet", ")", "else", ":", "# Check whether request is for subnets."...
Process subnet create event.
[ "Process", "subnet", "create", "event", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L630-L641
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.create_subnet
def create_subnet(self, snet): """Create subnet.""" snet_id = snet.get('id') # This checks if the source of the subnet creation is FW, # If yes, this event is ignored. if self.fw_api.is_subnet_source_fw(snet.get('tenant_id'), snet.get('...
python
def create_subnet(self, snet): """Create subnet.""" snet_id = snet.get('id') # This checks if the source of the subnet creation is FW, # If yes, this event is ignored. if self.fw_api.is_subnet_source_fw(snet.get('tenant_id'), snet.get('...
[ "def", "create_subnet", "(", "self", ",", "snet", ")", ":", "snet_id", "=", "snet", ".", "get", "(", "'id'", ")", "# This checks if the source of the subnet creation is FW,", "# If yes, this event is ignored.", "if", "self", ".", "fw_api", ".", "is_subnet_source_fw", ...
Create subnet.
[ "Create", "subnet", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L643-L695
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer._get_segmentation_id
def _get_segmentation_id(self, netid, segid, source): """Allocate segmentation id. """ return self.seg_drvr.allocate_segmentation_id(netid, seg_id=segid, source=source)
python
def _get_segmentation_id(self, netid, segid, source): """Allocate segmentation id. """ return self.seg_drvr.allocate_segmentation_id(netid, seg_id=segid, source=source)
[ "def", "_get_segmentation_id", "(", "self", ",", "netid", ",", "segid", ",", "source", ")", ":", "return", "self", ".", "seg_drvr", ".", "allocate_segmentation_id", "(", "netid", ",", "seg_id", "=", "segid", ",", "source", "=", "source", ")" ]
Allocate segmentation id.
[ "Allocate", "segmentation", "id", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L697-L701
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.network_create_func
def network_create_func(self, net): """Create network in database and dcnm :param net: network dictionary """ net_id = net['id'] net_name = net.get('name') network_db_elem = self.get_network(net_id) # Check if the source of network creation is FW and if yes, skip ...
python
def network_create_func(self, net): """Create network in database and dcnm :param net: network dictionary """ net_id = net['id'] net_name = net.get('name') network_db_elem = self.get_network(net_id) # Check if the source of network creation is FW and if yes, skip ...
[ "def", "network_create_func", "(", "self", ",", "net", ")", ":", "net_id", "=", "net", "[", "'id'", "]", "net_name", "=", "net", ".", "get", "(", "'name'", ")", "network_db_elem", "=", "self", ".", "get_network", "(", "net_id", ")", "# Check if the source ...
Create network in database and dcnm :param net: network dictionary
[ "Create", "network", "in", "database", "and", "dcnm", ":", "param", "net", ":", "network", "dictionary" ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L703-L799
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.network_delete_event
def network_delete_event(self, network_info): """Process network delete event.""" net_id = network_info['network_id'] if net_id not in self.network: LOG.error('network_delete_event: net_id %s does not exist.', net_id) return segid = self.ne...
python
def network_delete_event(self, network_info): """Process network delete event.""" net_id = network_info['network_id'] if net_id not in self.network: LOG.error('network_delete_event: net_id %s does not exist.', net_id) return segid = self.ne...
[ "def", "network_delete_event", "(", "self", ",", "network_info", ")", ":", "net_id", "=", "network_info", "[", "'network_id'", "]", "if", "net_id", "not", "in", "self", ".", "network", ":", "LOG", ".", "error", "(", "'network_delete_event: net_id %s does not exist...
Process network delete event.
[ "Process", "network", "delete", "event", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L809-L849
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.dcnm_network_create_event
def dcnm_network_create_event(self, network_info): """Process network create event from DCNM.""" # 1. Add network info to database before sending request to # neutron to create the network. # Check if network is already created. pre_seg_id = network_info.get('segmentation_id') ...
python
def dcnm_network_create_event(self, network_info): """Process network create event from DCNM.""" # 1. Add network info to database before sending request to # neutron to create the network. # Check if network is already created. pre_seg_id = network_info.get('segmentation_id') ...
[ "def", "dcnm_network_create_event", "(", "self", ",", "network_info", ")", ":", "# 1. Add network info to database before sending request to", "# neutron to create the network.", "# Check if network is already created.", "pre_seg_id", "=", "network_info", ".", "get", "(", "'segment...
Process network create event from DCNM.
[ "Process", "network", "create", "event", "from", "DCNM", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L851-L1003
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.dcnm_network_delete_event
def dcnm_network_delete_event(self, network_info): """Process network delete event from DCNM.""" seg_id = network_info.get('segmentation_id') if not seg_id: LOG.error('Failed to delete network. Invalid network ' 'info %s.', network_info) query_net = self...
python
def dcnm_network_delete_event(self, network_info): """Process network delete event from DCNM.""" seg_id = network_info.get('segmentation_id') if not seg_id: LOG.error('Failed to delete network. Invalid network ' 'info %s.', network_info) query_net = self...
[ "def", "dcnm_network_delete_event", "(", "self", ",", "network_info", ")", ":", "seg_id", "=", "network_info", ".", "get", "(", "'segmentation_id'", ")", "if", "not", "seg_id", ":", "LOG", ".", "error", "(", "'Failed to delete network. Invalid network '", "'info %s....
Process network delete event from DCNM.
[ "Process", "network", "delete", "event", "from", "DCNM", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1005-L1030
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.update_port_ip_address
def update_port_ip_address(self): """Find the ip address that assinged to a port via DHCP The port database will be updated with the ip address. """ leases = None req = dict(ip='0.0.0.0') instances = self.get_vms_for_this_req(**req) if instances is None: ...
python
def update_port_ip_address(self): """Find the ip address that assinged to a port via DHCP The port database will be updated with the ip address. """ leases = None req = dict(ip='0.0.0.0') instances = self.get_vms_for_this_req(**req) if instances is None: ...
[ "def", "update_port_ip_address", "(", "self", ")", ":", "leases", "=", "None", "req", "=", "dict", "(", "ip", "=", "'0.0.0.0'", ")", "instances", "=", "self", ".", "get_vms_for_this_req", "(", "*", "*", "req", ")", "if", "instances", "is", "None", ":", ...
Find the ip address that assinged to a port via DHCP The port database will be updated with the ip address.
[ "Find", "the", "ip", "address", "that", "assinged", "to", "a", "port", "via", "DHCP" ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1336-L1393
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.send_vm_info
def send_vm_info(self, vm_info): """Send vm info to the compute host. it will return True/False """ agent_host = vm_info.get('host') if not agent_host: LOG.info("vm/port is not bound to host, not sending vm info") return True try: self....
python
def send_vm_info(self, vm_info): """Send vm info to the compute host. it will return True/False """ agent_host = vm_info.get('host') if not agent_host: LOG.info("vm/port is not bound to host, not sending vm info") return True try: self....
[ "def", "send_vm_info", "(", "self", ",", "vm_info", ")", ":", "agent_host", "=", "vm_info", ".", "get", "(", "'host'", ")", "if", "not", "agent_host", ":", "LOG", ".", "info", "(", "\"vm/port is not bound to host, not sending vm info\"", ")", "return", "True", ...
Send vm info to the compute host. it will return True/False
[ "Send", "vm", "info", "to", "the", "compute", "host", ".", "it", "will", "return", "True", "/", "False" ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1404-L1422
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.request_vms_info
def request_vms_info(self, payload): """Get the VMs from the database and send the info to the agent.""" # This request is received from an agent when it runs for the first # time and uplink is detected. agent = payload.get('agent') LOG.debug('request_vms_info: Getting VMs info ...
python
def request_vms_info(self, payload): """Get the VMs from the database and send the info to the agent.""" # This request is received from an agent when it runs for the first # time and uplink is detected. agent = payload.get('agent') LOG.debug('request_vms_info: Getting VMs info ...
[ "def", "request_vms_info", "(", "self", ",", "payload", ")", ":", "# This request is received from an agent when it runs for the first", "# time and uplink is detected.", "agent", "=", "payload", ".", "get", "(", "'agent'", ")", "LOG", ".", "debug", "(", "'request_vms_inf...
Get the VMs from the database and send the info to the agent.
[ "Get", "the", "VMs", "from", "the", "database", "and", "send", "the", "info", "to", "the", "agent", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1465-L1491
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.request_uplink_info
def request_uplink_info(self, payload): """Get the uplink from the database and send the info to the agent.""" # This request is received from an agent when it run for the first # Send the uplink name (physical port name that connectes compute # node and switch ...
python
def request_uplink_info(self, payload): """Get the uplink from the database and send the info to the agent.""" # This request is received from an agent when it run for the first # Send the uplink name (physical port name that connectes compute # node and switch ...
[ "def", "request_uplink_info", "(", "self", ",", "payload", ")", ":", "# This request is received from an agent when it run for the first", "# Send the uplink name (physical port name that connectes compute", "# node and switch fabric),", "agent", "=", "payload", ...
Get the uplink from the database and send the info to the agent.
[ "Get", "the", "uplink", "from", "the", "database", "and", "send", "the", "info", "to", "the", "agent", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1493-L1508
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.set_static_ip_address
def set_static_ip_address(self, payload): """Set static ip address for a VM.""" # This request is received from CLI for setting ip address of an # instance. macaddr = payload.get('mac') ipaddr = payload.get('ip') # Find the entry associated with the mac in the database....
python
def set_static_ip_address(self, payload): """Set static ip address for a VM.""" # This request is received from CLI for setting ip address of an # instance. macaddr = payload.get('mac') ipaddr = payload.get('ip') # Find the entry associated with the mac in the database....
[ "def", "set_static_ip_address", "(", "self", ",", "payload", ")", ":", "# This request is received from CLI for setting ip address of an", "# instance.", "macaddr", "=", "payload", ".", "get", "(", "'mac'", ")", "ipaddr", "=", "payload", ".", "get", "(", "'ip'", ")"...
Set static ip address for a VM.
[ "Set", "static", "ip", "address", "for", "a", "VM", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1510-L1555
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.vm_result_update
def vm_result_update(self, payload): """Update the result field in VM database. This request comes from an agent that needs to update the result in VM database to success or failure to reflect the operation's result in the agent. """ port_id = payload.get('port_id') ...
python
def vm_result_update(self, payload): """Update the result field in VM database. This request comes from an agent that needs to update the result in VM database to success or failure to reflect the operation's result in the agent. """ port_id = payload.get('port_id') ...
[ "def", "vm_result_update", "(", "self", ",", "payload", ")", ":", "port_id", "=", "payload", ".", "get", "(", "'port_id'", ")", "result", "=", "payload", ".", "get", "(", "'result'", ")", "if", "port_id", "and", "result", ":", "# Update the VM's result field...
Update the result field in VM database. This request comes from an agent that needs to update the result in VM database to success or failure to reflect the operation's result in the agent.
[ "Update", "the", "result", "field", "in", "VM", "database", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1557-L1571
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.add_lbaas_port
def add_lbaas_port(self, port_id, lb_id): """Give port id, get port info and send vm info to agent. :param port_id: port id of vip port :param lb_id: vip id for v1 and lbaas_id for v2 """ port_info = self.neutronclient.show_port(port_id) port = port_info.get('port') ...
python
def add_lbaas_port(self, port_id, lb_id): """Give port id, get port info and send vm info to agent. :param port_id: port id of vip port :param lb_id: vip id for v1 and lbaas_id for v2 """ port_info = self.neutronclient.show_port(port_id) port = port_info.get('port') ...
[ "def", "add_lbaas_port", "(", "self", ",", "port_id", ",", "lb_id", ")", ":", "port_info", "=", "self", ".", "neutronclient", ".", "show_port", "(", "port_id", ")", "port", "=", "port_info", ".", "get", "(", "'port'", ")", "if", "not", "port", ":", "LO...
Give port id, get port info and send vm info to agent. :param port_id: port id of vip port :param lb_id: vip id for v1 and lbaas_id for v2
[ "Give", "port", "id", "get", "port", "info", "and", "send", "vm", "info", "to", "agent", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1581-L1603
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.delete_lbaas_port
def delete_lbaas_port(self, lb_id): """send vm down event and delete db. :param lb_id: vip id for v1 and lbaas_id for v2 """ lb_id = lb_id.replace('-', '') req = dict(instance_id=lb_id) instances = self.get_vms_for_this_req(**req) for vm in instances: ...
python
def delete_lbaas_port(self, lb_id): """send vm down event and delete db. :param lb_id: vip id for v1 and lbaas_id for v2 """ lb_id = lb_id.replace('-', '') req = dict(instance_id=lb_id) instances = self.get_vms_for_this_req(**req) for vm in instances: ...
[ "def", "delete_lbaas_port", "(", "self", ",", "lb_id", ")", ":", "lb_id", "=", "lb_id", ".", "replace", "(", "'-'", ",", "''", ")", "req", "=", "dict", "(", "instance_id", "=", "lb_id", ")", "instances", "=", "self", ".", "get_vms_for_this_req", "(", "...
send vm down event and delete db. :param lb_id: vip id for v1 and lbaas_id for v2
[ "send", "vm", "down", "event", "and", "delete", "db", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1605-L1615
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.vip_create_event
def vip_create_event(self, vip_info): """Process vip create event.""" vip_data = vip_info.get('vip') port_id = vip_data.get('port_id') vip_id = vip_data.get('id') self.add_lbaas_port(port_id, vip_id)
python
def vip_create_event(self, vip_info): """Process vip create event.""" vip_data = vip_info.get('vip') port_id = vip_data.get('port_id') vip_id = vip_data.get('id') self.add_lbaas_port(port_id, vip_id)
[ "def", "vip_create_event", "(", "self", ",", "vip_info", ")", ":", "vip_data", "=", "vip_info", ".", "get", "(", "'vip'", ")", "port_id", "=", "vip_data", ".", "get", "(", "'port_id'", ")", "vip_id", "=", "vip_data", ".", "get", "(", "'id'", ")", "self...
Process vip create event.
[ "Process", "vip", "create", "event", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1617-L1622
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.listener_create_event
def listener_create_event(self, listener_info): """Process listener create event. This is lbaas v2 vif will be plugged into ovs when first listener is created and unpluged from ovs when last listener is deleted """ listener_data = listener_info.get('listener') ...
python
def listener_create_event(self, listener_info): """Process listener create event. This is lbaas v2 vif will be plugged into ovs when first listener is created and unpluged from ovs when last listener is deleted """ listener_data = listener_info.get('listener') ...
[ "def", "listener_create_event", "(", "self", ",", "listener_info", ")", ":", "listener_data", "=", "listener_info", ".", "get", "(", "'listener'", ")", "lb_list", "=", "listener_data", ".", "get", "(", "'loadbalancers'", ")", "for", "lb", "in", "lb_list", ":",...
Process listener create event. This is lbaas v2 vif will be plugged into ovs when first listener is created and unpluged from ovs when last listener is deleted
[ "Process", "listener", "create", "event", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1629-L1649
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.listener_delete_event
def listener_delete_event(self, listener_info): """Process listener delete event. This is lbaas v2 vif will be plugged into ovs when first listener is created and unpluged from ovs when last listener is deleted. as the data only contains listener id, we will scan...
python
def listener_delete_event(self, listener_info): """Process listener delete event. This is lbaas v2 vif will be plugged into ovs when first listener is created and unpluged from ovs when last listener is deleted. as the data only contains listener id, we will scan...
[ "def", "listener_delete_event", "(", "self", ",", "listener_info", ")", ":", "lb_list", "=", "self", ".", "neutronclient", ".", "list_loadbalancers", "(", ")", "for", "lb", "in", "lb_list", ".", "get", "(", "'loadbalancers'", ")", ":", "if", "not", "lb", "...
Process listener delete event. This is lbaas v2 vif will be plugged into ovs when first listener is created and unpluged from ovs when last listener is deleted. as the data only contains listener id, we will scan all loadbalancers from db and delete the vdp if th...
[ "Process", "listener", "delete", "event", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1651-L1667
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.pool_create_event
def pool_create_event(self, pool_info): """Process pool create event. Extract pool info and get listener info and call next listen_create_event """ pool_data = pool_info.get('pool') listeners = pool_data.get('listeners') for listener in listeners: l_i...
python
def pool_create_event(self, pool_info): """Process pool create event. Extract pool info and get listener info and call next listen_create_event """ pool_data = pool_info.get('pool') listeners = pool_data.get('listeners') for listener in listeners: l_i...
[ "def", "pool_create_event", "(", "self", ",", "pool_info", ")", ":", "pool_data", "=", "pool_info", ".", "get", "(", "'pool'", ")", "listeners", "=", "pool_data", ".", "get", "(", "'listeners'", ")", "for", "listener", "in", "listeners", ":", "l_id", "=", ...
Process pool create event. Extract pool info and get listener info and call next listen_create_event
[ "Process", "pool", "create", "event", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1669-L1680
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.sync_projects
def sync_projects(self): """Sync projects. This function will retrieve project from keystone and populate them dfa database and dcnm """ p = self.keystone_event._service.projects.list() for proj in p: if proj.name in not_create_project_name: ...
python
def sync_projects(self): """Sync projects. This function will retrieve project from keystone and populate them dfa database and dcnm """ p = self.keystone_event._service.projects.list() for proj in p: if proj.name in not_create_project_name: ...
[ "def", "sync_projects", "(", "self", ")", ":", "p", "=", "self", ".", "keystone_event", ".", "_service", ".", "projects", ".", "list", "(", ")", "for", "proj", "in", "p", ":", "if", "proj", ".", "name", "in", "not_create_project_name", ":", "continue", ...
Sync projects. This function will retrieve project from keystone and populate them dfa database and dcnm
[ "Sync", "projects", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1690-L1701
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.sync_networks
def sync_networks(self): """sync networks. It will retrieve networks from neutron and populate them in dfa database and dcnm """ nets = self.neutronclient.list_networks() for net in nets.get("networks"): LOG.info("Syncing network %s", net["id"]) s...
python
def sync_networks(self): """sync networks. It will retrieve networks from neutron and populate them in dfa database and dcnm """ nets = self.neutronclient.list_networks() for net in nets.get("networks"): LOG.info("Syncing network %s", net["id"]) s...
[ "def", "sync_networks", "(", "self", ")", ":", "nets", "=", "self", ".", "neutronclient", ".", "list_networks", "(", ")", "for", "net", "in", "nets", ".", "get", "(", "\"networks\"", ")", ":", "LOG", ".", "info", "(", "\"Syncing network %s\"", ",", "net"...
sync networks. It will retrieve networks from neutron and populate them in dfa database and dcnm
[ "sync", "networks", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1703-L1716
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
DfaServer.create_threads
def create_threads(self): """Create threads on server.""" # Create thread for neutron notifications. neutron_thrd = utils.EventProcessingThread('Neutron_Event', self.neutron_event, 'event_handl...
python
def create_threads(self): """Create threads on server.""" # Create thread for neutron notifications. neutron_thrd = utils.EventProcessingThread('Neutron_Event', self.neutron_event, 'event_handl...
[ "def", "create_threads", "(", "self", ")", ":", "# Create thread for neutron notifications.", "neutron_thrd", "=", "utils", ".", "EventProcessingThread", "(", "'Neutron_Event'", ",", "self", ".", "neutron_event", ",", "'event_handler'", ",", "self", ".", "_excpq", ")"...
Create threads on server.
[ "Create", "threads", "on", "server", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1718-L1765
openstack/networking-cisco
networking_cisco/apps/saf/db/dfa_db_models.py
DfaSegmentTypeDriver._allocate_specified_segment
def _allocate_specified_segment(self, session, seg_id, source): """Allocate specified segment. If segment exists, then try to allocate it and return db object If segment does not exists, then try to create it and return db object If allocation/creation failed (duplicates), then return N...
python
def _allocate_specified_segment(self, session, seg_id, source): """Allocate specified segment. If segment exists, then try to allocate it and return db object If segment does not exists, then try to create it and return db object If allocation/creation failed (duplicates), then return N...
[ "def", "_allocate_specified_segment", "(", "self", ",", "session", ",", "seg_id", ",", "source", ")", ":", "try", ":", "with", "session", ".", "begin", "(", "subtransactions", "=", "True", ")", ":", "alloc", "=", "(", "session", ".", "query", "(", "self"...
Allocate specified segment. If segment exists, then try to allocate it and return db object If segment does not exists, then try to create it and return db object If allocation/creation failed (duplicates), then return None
[ "Allocate", "specified", "segment", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/db/dfa_db_models.py#L138-L171
openstack/networking-cisco
networking_cisco/apps/saf/db/dfa_db_models.py
DfaSegmentTypeDriver._allocate_segment
def _allocate_segment(self, session, net_id, source): """Allocate segment from pool. Return allocated db object or None. """ with session.begin(subtransactions=True): hour_lapse = utils.utc_time_lapse(self.seg_timeout) count = (session.query(self.model).filter( ...
python
def _allocate_segment(self, session, net_id, source): """Allocate segment from pool. Return allocated db object or None. """ with session.begin(subtransactions=True): hour_lapse = utils.utc_time_lapse(self.seg_timeout) count = (session.query(self.model).filter( ...
[ "def", "_allocate_segment", "(", "self", ",", "session", ",", "net_id", ",", "source", ")", ":", "with", "session", ".", "begin", "(", "subtransactions", "=", "True", ")", ":", "hour_lapse", "=", "utils", ".", "utc_time_lapse", "(", "self", ".", "seg_timeo...
Allocate segment from pool. Return allocated db object or None.
[ "Allocate", "segment", "from", "pool", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/db/dfa_db_models.py#L173-L207
openstack/networking-cisco
networking_cisco/apps/saf/db/dfa_db_models.py
DfasubnetDriver.allocate_subnet
def allocate_subnet(self, subnet_lst, net_id=None): """Allocate subnet from pool. Return allocated db object or None. """ session = db.get_session() query_str = None for sub in subnet_lst: sub_que = (self.model.subnet_address != sub) if query_str...
python
def allocate_subnet(self, subnet_lst, net_id=None): """Allocate subnet from pool. Return allocated db object or None. """ session = db.get_session() query_str = None for sub in subnet_lst: sub_que = (self.model.subnet_address != sub) if query_str...
[ "def", "allocate_subnet", "(", "self", ",", "subnet_lst", ",", "net_id", "=", "None", ")", ":", "session", "=", "db", ".", "get_session", "(", ")", "query_str", "=", "None", "for", "sub", "in", "subnet_lst", ":", "sub_que", "=", "(", "self", ".", "mode...
Allocate subnet from pool. Return allocated db object or None.
[ "Allocate", "subnet", "from", "pool", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/db/dfa_db_models.py#L935-L969
openstack/networking-cisco
networking_cisco/apps/saf/db/dfa_db_models.py
TopologyDiscoveryDb.add_update_topology_db
def add_update_topology_db(self, **params): """Add or update an entry to the topology DB. """ topo_dict = params.get('columns') session = db.get_session() host = topo_dict.get('host') protocol_interface = topo_dict.get('protocol_interface') with session.begin(subtransacti...
python
def add_update_topology_db(self, **params): """Add or update an entry to the topology DB. """ topo_dict = params.get('columns') session = db.get_session() host = topo_dict.get('host') protocol_interface = topo_dict.get('protocol_interface') with session.begin(subtransacti...
[ "def", "add_update_topology_db", "(", "self", ",", "*", "*", "params", ")", ":", "topo_dict", "=", "params", ".", "get", "(", "'columns'", ")", "session", "=", "db", ".", "get_session", "(", ")", "host", "=", "topo_dict", ".", "get", "(", "'host'", ")"...
Add or update an entry to the topology DB.
[ "Add", "or", "update", "an", "entry", "to", "the", "topology", "DB", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/db/dfa_db_models.py#L1067-L1106
openstack/networking-cisco
networking_cisco/apps/saf/db/dfa_db_models.py
TopologyDiscoveryDb._convert_topo_obj_dict
def _convert_topo_obj_dict(self, topology_objs): """Convert topology object to dict. """ topo_lst = [] for topo_obj in topology_objs: topo_dct = { 'host': topo_obj.host, 'protocol_interface': topo_obj.protocol_interface, 'phy_interface'...
python
def _convert_topo_obj_dict(self, topology_objs): """Convert topology object to dict. """ topo_lst = [] for topo_obj in topology_objs: topo_dct = { 'host': topo_obj.host, 'protocol_interface': topo_obj.protocol_interface, 'phy_interface'...
[ "def", "_convert_topo_obj_dict", "(", "self", ",", "topology_objs", ")", ":", "topo_lst", "=", "[", "]", "for", "topo_obj", "in", "topology_objs", ":", "topo_dct", "=", "{", "'host'", ":", "topo_obj", ".", "host", ",", "'protocol_interface'", ":", "topo_obj", ...
Convert topology object to dict.
[ "Convert", "topology", "object", "to", "dict", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/db/dfa_db_models.py#L1108-L1127
openstack/networking-cisco
networking_cisco/apps/saf/db/dfa_db_models.py
TopologyDiscoveryDb.query_topology_db
def query_topology_db(self, dict_convert=False, **req): """Query an entry to the topology DB. """ session = db.get_session() with session.begin(subtransactions=True): try: # Check if entry exists. topo_disc = session.query(DfaTopologyDb).filter_by(**re...
python
def query_topology_db(self, dict_convert=False, **req): """Query an entry to the topology DB. """ session = db.get_session() with session.begin(subtransactions=True): try: # Check if entry exists. topo_disc = session.query(DfaTopologyDb).filter_by(**re...
[ "def", "query_topology_db", "(", "self", ",", "dict_convert", "=", "False", ",", "*", "*", "req", ")", ":", "session", "=", "db", ".", "get_session", "(", ")", "with", "session", ".", "begin", "(", "subtransactions", "=", "True", ")", ":", "try", ":", ...
Query an entry to the topology DB.
[ "Query", "an", "entry", "to", "the", "topology", "DB", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/db/dfa_db_models.py#L1129-L1141
openstack/networking-cisco
networking_cisco/apps/saf/db/dfa_db_models.py
TopologyDiscoveryDb.delete_topology_entry
def delete_topology_entry(self, **req): """Delete the entries from the topology DB. """ session = db.get_session() with session.begin(subtransactions=True): try: rows = session.query(DfaTopologyDb).filter_by(**req).all() except orm_exc.NoResultFound: ...
python
def delete_topology_entry(self, **req): """Delete the entries from the topology DB. """ session = db.get_session() with session.begin(subtransactions=True): try: rows = session.query(DfaTopologyDb).filter_by(**req).all() except orm_exc.NoResultFound: ...
[ "def", "delete_topology_entry", "(", "self", ",", "*", "*", "req", ")", ":", "session", "=", "db", ".", "get_session", "(", ")", "with", "session", ".", "begin", "(", "subtransactions", "=", "True", ")", ":", "try", ":", "rows", "=", "session", ".", ...
Delete the entries from the topology DB.
[ "Delete", "the", "entries", "from", "the", "topology", "DB", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/db/dfa_db_models.py#L1143-L1156
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.enable_lldp
def enable_lldp(self, port_name, is_ncb=True, is_nb=False): """Function to enable LLDP on the interface. """ reply = None if is_ncb: reply = self.run_lldptool(["-L", "-i", port_name, "-g", "ncb", "adminStatus=rxtx"]) elif is_nb: ...
python
def enable_lldp(self, port_name, is_ncb=True, is_nb=False): """Function to enable LLDP on the interface. """ reply = None if is_ncb: reply = self.run_lldptool(["-L", "-i", port_name, "-g", "ncb", "adminStatus=rxtx"]) elif is_nb: ...
[ "def", "enable_lldp", "(", "self", ",", "port_name", ",", "is_ncb", "=", "True", ",", "is_nb", "=", "False", ")", ":", "reply", "=", "None", "if", "is_ncb", ":", "reply", "=", "self", ".", "run_lldptool", "(", "[", "\"-L\"", ",", "\"-i\"", ",", "port...
Function to enable LLDP on the interface.
[ "Function", "to", "enable", "LLDP", "on", "the", "interface", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L32-L51
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.get_lldp_tlv
def get_lldp_tlv(self, port_name, is_ncb=True, is_nb=False): """Function to Query LLDP TLV on the interface. """ reply = None if is_ncb: reply = self.run_lldptool(["get-tlv", "-n", "-i", port_name, "-g", "ncb"]) elif is_nb: r...
python
def get_lldp_tlv(self, port_name, is_ncb=True, is_nb=False): """Function to Query LLDP TLV on the interface. """ reply = None if is_ncb: reply = self.run_lldptool(["get-tlv", "-n", "-i", port_name, "-g", "ncb"]) elif is_nb: r...
[ "def", "get_lldp_tlv", "(", "self", ",", "port_name", ",", "is_ncb", "=", "True", ",", "is_nb", "=", "False", ")", ":", "reply", "=", "None", "if", "is_ncb", ":", "reply", "=", "self", ".", "run_lldptool", "(", "[", "\"get-tlv\"", ",", "\"-n\"", ",", ...
Function to Query LLDP TLV on the interface.
[ "Function", "to", "Query", "LLDP", "TLV", "on", "the", "interface", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L53-L65
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.run_lldptool
def run_lldptool(self, args): """Function for invoking the lldptool utility. """ full_args = ['lldptool'] + args try: return utils.execute(full_args, root_helper=self.root_helper) except Exception as exc: LOG.error("Unable to execute %(cmd)s. " ...
python
def run_lldptool(self, args): """Function for invoking the lldptool utility. """ full_args = ['lldptool'] + args try: return utils.execute(full_args, root_helper=self.root_helper) except Exception as exc: LOG.error("Unable to execute %(cmd)s. " ...
[ "def", "run_lldptool", "(", "self", ",", "args", ")", ":", "full_args", "=", "[", "'lldptool'", "]", "+", "args", "try", ":", "return", "utils", ".", "execute", "(", "full_args", ",", "root_helper", "=", "self", ".", "root_helper", ")", "except", "Except...
Function for invoking the lldptool utility.
[ "Function", "for", "invoking", "the", "lldptool", "utility", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L67-L75
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi._check_common_tlv_format
def _check_common_tlv_format(self, tlv_complete_data, tlv_data_pattern, tlv_string): """Check for the common TLV format. """ if tlv_complete_data is None: return False, None tlv_string_split = tlv_complete_data.split(tlv_string) if len(tlv_str...
python
def _check_common_tlv_format(self, tlv_complete_data, tlv_data_pattern, tlv_string): """Check for the common TLV format. """ if tlv_complete_data is None: return False, None tlv_string_split = tlv_complete_data.split(tlv_string) if len(tlv_str...
[ "def", "_check_common_tlv_format", "(", "self", ",", "tlv_complete_data", ",", "tlv_data_pattern", ",", "tlv_string", ")", ":", "if", "tlv_complete_data", "is", "None", ":", "return", "False", ",", "None", "tlv_string_split", "=", "tlv_complete_data", ".", "split", ...
Check for the common TLV format.
[ "Check", "for", "the", "common", "TLV", "format", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L77-L89
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.get_remote_evb_mode
def get_remote_evb_mode(self, tlv_data): """Returns the EVB mode in the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "mode:", "EVB Configuration TLV") if not ret: return None mode_val = parsed_val[1].split()[0].strip() return mode_va...
python
def get_remote_evb_mode(self, tlv_data): """Returns the EVB mode in the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "mode:", "EVB Configuration TLV") if not ret: return None mode_val = parsed_val[1].split()[0].strip() return mode_va...
[ "def", "get_remote_evb_mode", "(", "self", ",", "tlv_data", ")", ":", "ret", ",", "parsed_val", "=", "self", ".", "_check_common_tlv_format", "(", "tlv_data", ",", "\"mode:\"", ",", "\"EVB Configuration TLV\"", ")", "if", "not", "ret", ":", "return", "None", "...
Returns the EVB mode in the TLV.
[ "Returns", "the", "EVB", "mode", "in", "the", "TLV", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L96-L103
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.get_remote_mgmt_addr
def get_remote_mgmt_addr(self, tlv_data): """Returns Remote Mgmt Addr from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "IPv4:", "Management Address TLV") if not ret: return None addr_fam = 'IPv4:' addr = parsed_val[1].split('\n'...
python
def get_remote_mgmt_addr(self, tlv_data): """Returns Remote Mgmt Addr from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "IPv4:", "Management Address TLV") if not ret: return None addr_fam = 'IPv4:' addr = parsed_val[1].split('\n'...
[ "def", "get_remote_mgmt_addr", "(", "self", ",", "tlv_data", ")", ":", "ret", ",", "parsed_val", "=", "self", ".", "_check_common_tlv_format", "(", "tlv_data", ",", "\"IPv4:\"", ",", "\"Management Address TLV\"", ")", "if", "not", "ret", ":", "return", "None", ...
Returns Remote Mgmt Addr from the TLV.
[ "Returns", "Remote", "Mgmt", "Addr", "from", "the", "TLV", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L105-L113
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.get_remote_sys_desc
def get_remote_sys_desc(self, tlv_data): """Returns Remote Sys Desc from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "\n", "System Description TLV") if not ret: return None return parsed_val[1].strip()
python
def get_remote_sys_desc(self, tlv_data): """Returns Remote Sys Desc from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "\n", "System Description TLV") if not ret: return None return parsed_val[1].strip()
[ "def", "get_remote_sys_desc", "(", "self", ",", "tlv_data", ")", ":", "ret", ",", "parsed_val", "=", "self", ".", "_check_common_tlv_format", "(", "tlv_data", ",", "\"\\n\"", ",", "\"System Description TLV\"", ")", "if", "not", "ret", ":", "return", "None", "r...
Returns Remote Sys Desc from the TLV.
[ "Returns", "Remote", "Sys", "Desc", "from", "the", "TLV", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L115-L121
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.get_remote_sys_name
def get_remote_sys_name(self, tlv_data): """Returns Remote Sys Name from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "\n", "System Name TLV") if not ret: return None return parsed_val[1].strip()
python
def get_remote_sys_name(self, tlv_data): """Returns Remote Sys Name from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "\n", "System Name TLV") if not ret: return None return parsed_val[1].strip()
[ "def", "get_remote_sys_name", "(", "self", ",", "tlv_data", ")", ":", "ret", ",", "parsed_val", "=", "self", ".", "_check_common_tlv_format", "(", "tlv_data", ",", "\"\\n\"", ",", "\"System Name TLV\"", ")", "if", "not", "ret", ":", "return", "None", "return",...
Returns Remote Sys Name from the TLV.
[ "Returns", "Remote", "Sys", "Name", "from", "the", "TLV", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L123-L129
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.get_remote_port
def get_remote_port(self, tlv_data): """Returns Remote Port from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "\n", "Port Description TLV") if not ret: return None return parsed_val[1].strip()
python
def get_remote_port(self, tlv_data): """Returns Remote Port from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "\n", "Port Description TLV") if not ret: return None return parsed_val[1].strip()
[ "def", "get_remote_port", "(", "self", ",", "tlv_data", ")", ":", "ret", ",", "parsed_val", "=", "self", ".", "_check_common_tlv_format", "(", "tlv_data", ",", "\"\\n\"", ",", "\"Port Description TLV\"", ")", "if", "not", "ret", ":", "return", "None", "return"...
Returns Remote Port from the TLV.
[ "Returns", "Remote", "Port", "from", "the", "TLV", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L131-L137
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.get_remote_chassis_id_mac
def get_remote_chassis_id_mac(self, tlv_data): """Returns Remote Chassis ID MAC from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "MAC:", "Chassis ID TLV") if not ret: return None mac = parsed_val[1].split('\n') return mac[0].str...
python
def get_remote_chassis_id_mac(self, tlv_data): """Returns Remote Chassis ID MAC from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "MAC:", "Chassis ID TLV") if not ret: return None mac = parsed_val[1].split('\n') return mac[0].str...
[ "def", "get_remote_chassis_id_mac", "(", "self", ",", "tlv_data", ")", ":", "ret", ",", "parsed_val", "=", "self", ".", "_check_common_tlv_format", "(", "tlv_data", ",", "\"MAC:\"", ",", "\"Chassis ID TLV\"", ")", "if", "not", "ret", ":", "return", "None", "ma...
Returns Remote Chassis ID MAC from the TLV.
[ "Returns", "Remote", "Chassis", "ID", "MAC", "from", "the", "TLV", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L139-L146
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py
LldpApi.get_remote_port_id_local
def get_remote_port_id_local(self, tlv_data): """Returns Remote Port ID Local from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "Local:", "Port ID TLV") if not ret: return None local = parsed_val[1].split('\n') return local[0].st...
python
def get_remote_port_id_local(self, tlv_data): """Returns Remote Port ID Local from the TLV. """ ret, parsed_val = self._check_common_tlv_format( tlv_data, "Local:", "Port ID TLV") if not ret: return None local = parsed_val[1].split('\n') return local[0].st...
[ "def", "get_remote_port_id_local", "(", "self", ",", "tlv_data", ")", ":", "ret", ",", "parsed_val", "=", "self", ".", "_check_common_tlv_format", "(", "tlv_data", ",", "\"Local:\"", ",", "\"Port ID TLV\"", ")", "if", "not", "ret", ":", "return", "None", "loca...
Returns Remote Port ID Local from the TLV.
[ "Returns", "Remote", "Port", "ID", "Local", "from", "the", "TLV", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/pub_lldp_api.py#L157-L164
openstack/networking-cisco
networking_cisco/ml2_drivers/nexus/nexus_helpers.py
format_interface_name
def format_interface_name(intf_type, port, ch_grp=0): """Method to format interface name given type, port. Given interface type, port, and channel-group, this method formats an interface name. If channel-group is non-zero, then port-channel is configured. :param intf_type: Such as 'ethernet' or '...
python
def format_interface_name(intf_type, port, ch_grp=0): """Method to format interface name given type, port. Given interface type, port, and channel-group, this method formats an interface name. If channel-group is non-zero, then port-channel is configured. :param intf_type: Such as 'ethernet' or '...
[ "def", "format_interface_name", "(", "intf_type", ",", "port", ",", "ch_grp", "=", "0", ")", ":", "if", "ch_grp", ">", "0", ":", "return", "'port-channel:%s'", "%", "str", "(", "ch_grp", ")", "return", "'%s:%s'", "%", "(", "intf_type", ".", "lower", "(",...
Method to format interface name given type, port. Given interface type, port, and channel-group, this method formats an interface name. If channel-group is non-zero, then port-channel is configured. :param intf_type: Such as 'ethernet' or 'port-channel' :param port: unique identification -- 1/32 ...
[ "Method", "to", "format", "interface", "name", "given", "type", "port", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_helpers.py#L23-L40
openstack/networking-cisco
networking_cisco/ml2_drivers/nexus/nexus_helpers.py
split_interface_name
def split_interface_name(interface, ch_grp=0): """Method to split interface type, id from name. Takes an interface name or just interface suffix and returns interface type and number separately. :param interface: interface name or just suffix :param ch_grp: if non-zero, ignore interface ...
python
def split_interface_name(interface, ch_grp=0): """Method to split interface type, id from name. Takes an interface name or just interface suffix and returns interface type and number separately. :param interface: interface name or just suffix :param ch_grp: if non-zero, ignore interface ...
[ "def", "split_interface_name", "(", "interface", ",", "ch_grp", "=", "0", ")", ":", "interface", "=", "interface", ".", "lower", "(", ")", "if", "ch_grp", "!=", "0", ":", "intf_type", "=", "'port-channel'", "port", "=", "str", "(", "ch_grp", ")", "elif",...
Method to split interface type, id from name. Takes an interface name or just interface suffix and returns interface type and number separately. :param interface: interface name or just suffix :param ch_grp: if non-zero, ignore interface name and return 'port-channel' grp :retur...
[ "Method", "to", "split", "interface", "type", "id", "from", "name", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_helpers.py#L43-L71
openstack/networking-cisco
networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py
DeviceMgrCfgAgentNotifyAPI._host_notification
def _host_notification(self, context, method, payload, host): """Notify the cfg agent that is handling the hosting device.""" LOG.debug('Notify Cisco cfg agent at %(host)s the message ' '%(method)s', {'host': host, 'method': method}) cctxt = self.client.prepare(server=host) ...
python
def _host_notification(self, context, method, payload, host): """Notify the cfg agent that is handling the hosting device.""" LOG.debug('Notify Cisco cfg agent at %(host)s the message ' '%(method)s', {'host': host, 'method': method}) cctxt = self.client.prepare(server=host) ...
[ "def", "_host_notification", "(", "self", ",", "context", ",", "method", ",", "payload", ",", "host", ")", ":", "LOG", ".", "debug", "(", "'Notify Cisco cfg agent at %(host)s the message '", "'%(method)s'", ",", "{", "'host'", ":", "host", ",", "'method'", ":", ...
Notify the cfg agent that is handling the hosting device.
[ "Notify", "the", "cfg", "agent", "that", "is", "handling", "the", "hosting", "device", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py#L39-L44
openstack/networking-cisco
networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py
DeviceMgrCfgAgentNotifyAPI._agent_notification
def _agent_notification(self, context, method, hosting_devices, operation): """Notify individual Cisco cfg agents.""" admin_context = context.is_admin and context or context.elevated() for hosting_device in hosting_devices: agents = self._dmplugin.get_cfg_agents_for_hosting_devices( ...
python
def _agent_notification(self, context, method, hosting_devices, operation): """Notify individual Cisco cfg agents.""" admin_context = context.is_admin and context or context.elevated() for hosting_device in hosting_devices: agents = self._dmplugin.get_cfg_agents_for_hosting_devices( ...
[ "def", "_agent_notification", "(", "self", ",", "context", ",", "method", ",", "hosting_devices", ",", "operation", ")", ":", "admin_context", "=", "context", ".", "is_admin", "and", "context", "or", "context", ".", "elevated", "(", ")", "for", "hosting_device...
Notify individual Cisco cfg agents.
[ "Notify", "individual", "Cisco", "cfg", "agents", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py#L46-L61
openstack/networking-cisco
networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py
DeviceMgrCfgAgentNotifyAPI.agent_updated
def agent_updated(self, context, admin_state_up, host): """Updates cfg agent on <host> to enable or disable it.""" self._host_notification(context, 'agent_updated', {'admin_state_up': admin_state_up}, host)
python
def agent_updated(self, context, admin_state_up, host): """Updates cfg agent on <host> to enable or disable it.""" self._host_notification(context, 'agent_updated', {'admin_state_up': admin_state_up}, host)
[ "def", "agent_updated", "(", "self", ",", "context", ",", "admin_state_up", ",", "host", ")", ":", "self", ".", "_host_notification", "(", "context", ",", "'agent_updated'", ",", "{", "'admin_state_up'", ":", "admin_state_up", "}", ",", "host", ")" ]
Updates cfg agent on <host> to enable or disable it.
[ "Updates", "cfg", "agent", "on", "<host", ">", "to", "enable", "or", "disable", "it", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py#L63-L66
openstack/networking-cisco
networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py
DeviceMgrCfgAgentNotifyAPI.hosting_devices_unassigned_from_cfg_agent
def hosting_devices_unassigned_from_cfg_agent(self, context, ids, host): """Notify cfg agent to no longer handle some hosting devices. This notification relieves the cfg agent in <host> of responsibility to monitor and configure hosting devices with id specified in <ids>. """ se...
python
def hosting_devices_unassigned_from_cfg_agent(self, context, ids, host): """Notify cfg agent to no longer handle some hosting devices. This notification relieves the cfg agent in <host> of responsibility to monitor and configure hosting devices with id specified in <ids>. """ se...
[ "def", "hosting_devices_unassigned_from_cfg_agent", "(", "self", ",", "context", ",", "ids", ",", "host", ")", ":", "self", ".", "_host_notification", "(", "context", ",", "'hosting_devices_unassigned_from_cfg_agent'", ",", "{", "'hosting_device_ids'", ":", "ids", "}"...
Notify cfg agent to no longer handle some hosting devices. This notification relieves the cfg agent in <host> of responsibility to monitor and configure hosting devices with id specified in <ids>.
[ "Notify", "cfg", "agent", "to", "no", "longer", "handle", "some", "hosting", "devices", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py#L68-L76
openstack/networking-cisco
networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py
DeviceMgrCfgAgentNotifyAPI.hosting_devices_assigned_to_cfg_agent
def hosting_devices_assigned_to_cfg_agent(self, context, ids, host): """Notify cfg agent to now handle some hosting devices. This notification relieves the cfg agent in <host> of responsibility to monitor and configure hosting devices with id specified in <ids>. """ self._host_n...
python
def hosting_devices_assigned_to_cfg_agent(self, context, ids, host): """Notify cfg agent to now handle some hosting devices. This notification relieves the cfg agent in <host> of responsibility to monitor and configure hosting devices with id specified in <ids>. """ self._host_n...
[ "def", "hosting_devices_assigned_to_cfg_agent", "(", "self", ",", "context", ",", "ids", ",", "host", ")", ":", "self", ".", "_host_notification", "(", "context", ",", "'hosting_devices_assigned_to_cfg_agent'", ",", "{", "'hosting_device_ids'", ":", "ids", "}", ",",...
Notify cfg agent to now handle some hosting devices. This notification relieves the cfg agent in <host> of responsibility to monitor and configure hosting devices with id specified in <ids>.
[ "Notify", "cfg", "agent", "to", "now", "handle", "some", "hosting", "devices", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py#L78-L86
openstack/networking-cisco
networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py
DeviceMgrCfgAgentNotifyAPI.hosting_devices_removed
def hosting_devices_removed(self, context, hosting_data, deconfigure, host): """Notify cfg agent that some hosting devices have been removed. This notification informs the cfg agent in <host> that the hosting devices in the <hosting_data> dictionary have been rem...
python
def hosting_devices_removed(self, context, hosting_data, deconfigure, host): """Notify cfg agent that some hosting devices have been removed. This notification informs the cfg agent in <host> that the hosting devices in the <hosting_data> dictionary have been rem...
[ "def", "hosting_devices_removed", "(", "self", ",", "context", ",", "hosting_data", ",", "deconfigure", ",", "host", ")", ":", "if", "hosting_data", ":", "self", ".", "_host_notification", "(", "context", ",", "'hosting_devices_removed'", ",", "{", "'hosting_data'...
Notify cfg agent that some hosting devices have been removed. This notification informs the cfg agent in <host> that the hosting devices in the <hosting_data> dictionary have been removed from the hosting device pool. The <hosting_data> dictionary also contains the ids of the affected l...
[ "Notify", "cfg", "agent", "that", "some", "hosting", "devices", "have", "been", "removed", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py#L88-L112
openstack/networking-cisco
networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py
DeviceMgrCfgAgentNotifyAPI.get_hosting_device_configuration
def get_hosting_device_configuration(self, context, id): """Fetch configuration of hosting device with id. The configuration agent should respond with the running config of the hosting device. """ admin_context = context.is_admin and context or context.elevated() agents ...
python
def get_hosting_device_configuration(self, context, id): """Fetch configuration of hosting device with id. The configuration agent should respond with the running config of the hosting device. """ admin_context = context.is_admin and context or context.elevated() agents ...
[ "def", "get_hosting_device_configuration", "(", "self", ",", "context", ",", "id", ")", ":", "admin_context", "=", "context", ".", "is_admin", "and", "context", "or", "context", ".", "elevated", "(", ")", "agents", "=", "self", ".", "_dmplugin", ".", "get_cf...
Fetch configuration of hosting device with id. The configuration agent should respond with the running config of the hosting device.
[ "Fetch", "configuration", "of", "hosting", "device", "with", "id", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/device_manager/rpc/devmgr_rpc_cfgagent_api.py#L115-L127
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.store_policy
def store_policy(self, pol_id, policy): """Store the policy. Policy is maintained as a dictionary of pol ID. """ if pol_id not in self.policies: self.policies[pol_id] = policy self.policy_cnt += 1
python
def store_policy(self, pol_id, policy): """Store the policy. Policy is maintained as a dictionary of pol ID. """ if pol_id not in self.policies: self.policies[pol_id] = policy self.policy_cnt += 1
[ "def", "store_policy", "(", "self", ",", "pol_id", ",", "policy", ")", ":", "if", "pol_id", "not", "in", "self", ".", "policies", ":", "self", ".", "policies", "[", "pol_id", "]", "=", "policy", "self", ".", "policy_cnt", "+=", "1" ]
Store the policy. Policy is maintained as a dictionary of pol ID.
[ "Store", "the", "policy", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L106-L113
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.store_rule
def store_rule(self, rule_id, rule): """Store the rules. Policy is maintained as a dictionary of Rule ID. """ if rule_id not in self.rules: self.rules[rule_id] = rule self.rule_cnt += 1
python
def store_rule(self, rule_id, rule): """Store the rules. Policy is maintained as a dictionary of Rule ID. """ if rule_id not in self.rules: self.rules[rule_id] = rule self.rule_cnt += 1
[ "def", "store_rule", "(", "self", ",", "rule_id", ",", "rule", ")", ":", "if", "rule_id", "not", "in", "self", ".", "rules", ":", "self", ".", "rules", "[", "rule_id", "]", "=", "rule", "self", ".", "rule_cnt", "+=", "1" ]
Store the rules. Policy is maintained as a dictionary of Rule ID.
[ "Store", "the", "rules", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L115-L122
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.delete_rule
def delete_rule(self, rule_id): """Delete the specific Rule from dictionary indexed by rule id. """ if rule_id not in self.rules: LOG.error("No Rule id present for deleting %s", rule_id) return del self.rules[rule_id] self.rule_cnt -= 1
python
def delete_rule(self, rule_id): """Delete the specific Rule from dictionary indexed by rule id. """ if rule_id not in self.rules: LOG.error("No Rule id present for deleting %s", rule_id) return del self.rules[rule_id] self.rule_cnt -= 1
[ "def", "delete_rule", "(", "self", ",", "rule_id", ")", ":", "if", "rule_id", "not", "in", "self", ".", "rules", ":", "LOG", ".", "error", "(", "\"No Rule id present for deleting %s\"", ",", "rule_id", ")", "return", "del", "self", ".", "rules", "[", "rule...
Delete the specific Rule from dictionary indexed by rule id.
[ "Delete", "the", "specific", "Rule", "from", "dictionary", "indexed", "by", "rule", "id", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L124-L130
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.rule_update
def rule_update(self, rule_id, rule): """Update the rule. """ if rule_id not in self.rules: LOG.error("Rule ID not present %s", rule_id) return self.rules[rule_id].update(rule)
python
def rule_update(self, rule_id, rule): """Update the rule. """ if rule_id not in self.rules: LOG.error("Rule ID not present %s", rule_id) return self.rules[rule_id].update(rule)
[ "def", "rule_update", "(", "self", ",", "rule_id", ",", "rule", ")", ":", "if", "rule_id", "not", "in", "self", ".", "rules", ":", "LOG", ".", "error", "(", "\"Rule ID not present %s\"", ",", "rule_id", ")", "return", "self", ".", "rules", "[", "rule_id"...
Update the rule.
[ "Update", "the", "rule", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L142-L147
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.is_fw_present
def is_fw_present(self, fw_id): """Returns if firewall index by ID is present in dictionary. """ if self.fw_id is None or self.fw_id != fw_id: return False else: return True
python
def is_fw_present(self, fw_id): """Returns if firewall index by ID is present in dictionary. """ if self.fw_id is None or self.fw_id != fw_id: return False else: return True
[ "def", "is_fw_present", "(", "self", ",", "fw_id", ")", ":", "if", "self", ".", "fw_id", "is", "None", "or", "self", ".", "fw_id", "!=", "fw_id", ":", "return", "False", "else", ":", "return", "True" ]
Returns if firewall index by ID is present in dictionary.
[ "Returns", "if", "firewall", "index", "by", "ID", "is", "present", "in", "dictionary", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L153-L158
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.create_fw
def create_fw(self, proj_name, pol_id, fw_id, fw_name, fw_type, rtr_id): """Fills up the local attributes when FW is created. """ self.tenant_name = proj_name self.fw_id = fw_id self.fw_name = fw_name self.fw_created = True self.active_pol_id = pol_id self.fw_type...
python
def create_fw(self, proj_name, pol_id, fw_id, fw_name, fw_type, rtr_id): """Fills up the local attributes when FW is created. """ self.tenant_name = proj_name self.fw_id = fw_id self.fw_name = fw_name self.fw_created = True self.active_pol_id = pol_id self.fw_type...
[ "def", "create_fw", "(", "self", ",", "proj_name", ",", "pol_id", ",", "fw_id", ",", "fw_name", ",", "fw_type", ",", "rtr_id", ")", ":", "self", ".", "tenant_name", "=", "proj_name", "self", ".", "fw_id", "=", "fw_id", "self", ".", "fw_name", "=", "fw_...
Fills up the local attributes when FW is created.
[ "Fills", "up", "the", "local", "attributes", "when", "FW", "is", "created", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L160-L168
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.delete_fw
def delete_fw(self, fw_id): """Deletes the FW local attributes. """ self.fw_id = None self.fw_name = None self.fw_created = False self.active_pol_id = None
python
def delete_fw(self, fw_id): """Deletes the FW local attributes. """ self.fw_id = None self.fw_name = None self.fw_created = False self.active_pol_id = None
[ "def", "delete_fw", "(", "self", ",", "fw_id", ")", ":", "self", ".", "fw_id", "=", "None", "self", ".", "fw_name", "=", "None", "self", ".", "fw_created", "=", "False", "self", ".", "active_pol_id", "=", "None" ]
Deletes the FW local attributes.
[ "Deletes", "the", "FW", "local", "attributes", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L170-L175
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.delete_policy
def delete_policy(self, pol_id): """Deletes the policy from the local dictionary. """ if pol_id not in self.policies: LOG.error("Invalid policy %s", pol_id) return del self.policies[pol_id] self.policy_cnt -= 1
python
def delete_policy(self, pol_id): """Deletes the policy from the local dictionary. """ if pol_id not in self.policies: LOG.error("Invalid policy %s", pol_id) return del self.policies[pol_id] self.policy_cnt -= 1
[ "def", "delete_policy", "(", "self", ",", "pol_id", ")", ":", "if", "pol_id", "not", "in", "self", ".", "policies", ":", "LOG", ".", "error", "(", "\"Invalid policy %s\"", ",", "pol_id", ")", "return", "del", "self", ".", "policies", "[", "pol_id", "]", ...
Deletes the policy from the local dictionary.
[ "Deletes", "the", "policy", "from", "the", "local", "dictionary", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L177-L183
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.is_fw_complete
def is_fw_complete(self): """This API returns the completion status of FW. This returns True if a FW is created with a active policy that has more than one rule associated with it and if a driver init is done successfully. """ LOG.info("In fw_complete needed %(fw_created...
python
def is_fw_complete(self): """This API returns the completion status of FW. This returns True if a FW is created with a active policy that has more than one rule associated with it and if a driver init is done successfully. """ LOG.info("In fw_complete needed %(fw_created...
[ "def", "is_fw_complete", "(", "self", ")", ":", "LOG", ".", "info", "(", "\"In fw_complete needed %(fw_created)s \"", "\"%(active_policy_id)s %(is_fw_drvr_created)s \"", "\"%(pol_present)s %(fw_type)s\"", ",", "{", "'fw_created'", ":", "self", ".", "fw_created", ",", "'acti...
This API returns the completion status of FW. This returns True if a FW is created with a active policy that has more than one rule associated with it and if a driver init is done successfully.
[ "This", "API", "returns", "the", "completion", "status", "of", "FW", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L185-L210
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.one_rule_present
def one_rule_present(self, pol_id): """Returns if atleast one rule is present in the policy. """ pol_dict = self.policies[pol_id] for rule in pol_dict['rule_dict']: if self.is_rule_present(rule): return True return False
python
def one_rule_present(self, pol_id): """Returns if atleast one rule is present in the policy. """ pol_dict = self.policies[pol_id] for rule in pol_dict['rule_dict']: if self.is_rule_present(rule): return True return False
[ "def", "one_rule_present", "(", "self", ",", "pol_id", ")", ":", "pol_dict", "=", "self", ".", "policies", "[", "pol_id", "]", "for", "rule", "in", "pol_dict", "[", "'rule_dict'", "]", ":", "if", "self", ".", "is_rule_present", "(", "rule", ")", ":", "...
Returns if atleast one rule is present in the policy.
[ "Returns", "if", "atleast", "one", "rule", "is", "present", "in", "the", "policy", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L240-L246
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
FwMapAttr.get_fw_dict
def get_fw_dict(self): """This API creates a FW dictionary from the local attributes. """ fw_dict = {} if self.fw_id is None: return fw_dict fw_dict = {'rules': {}, 'tenant_name': self.tenant_name, 'tenant_id': self.tenant_id, 'fw_id': self.fw_id, ...
python
def get_fw_dict(self): """This API creates a FW dictionary from the local attributes. """ fw_dict = {} if self.fw_id is None: return fw_dict fw_dict = {'rules': {}, 'tenant_name': self.tenant_name, 'tenant_id': self.tenant_id, 'fw_id': self.fw_id, ...
[ "def", "get_fw_dict", "(", "self", ")", ":", "fw_dict", "=", "{", "}", "if", "self", ".", "fw_id", "is", "None", ":", "return", "fw_dict", "fw_dict", "=", "{", "'rules'", ":", "{", "}", ",", "'tenant_name'", ":", "self", ".", "tenant_name", ",", "'te...
This API creates a FW dictionary from the local attributes.
[ "This", "API", "creates", "a", "FW", "dictionary", "from", "the", "local", "attributes", "." ]
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L262-L281