def get_device_details(self, rpc_context, **kwargs): """Agent requests device details.""" agent_id = kwargs.get('agent_id') device = kwargs.get('device') LOG.debug(_("Device %(device)s details requested from %(agent_id)s"), { 'device': device, 'agent_id': agent_id }) port = ovs_db_v2.get_port(device) if port: binding = ovs_db_v2.get_network_binding(None, port['network_id']) entry = { 'device': device, 'network_id': port['network_id'], 'port_id': port['id'], 'admin_state_up': port['admin_state_up'], 'network_type': binding.network_type, 'segmentation_id': binding.segmentation_id, 'physical_network': binding.physical_network } new_status = (q_const.PORT_STATUS_ACTIVE if port['admin_state_up'] else q_const.PORT_STATUS_DOWN) if port['status'] != new_status: ovs_db_v2.set_port_status(port['id'], new_status) else: entry = {'device': device} LOG.debug(_("%s can not be found in database"), device) return entry
def update_device_up(self, rpc_context, **kwargs): """Device is up on agent""" agent_id = kwargs.get("agent_id") device = kwargs.get("device") LOG.debug(_("Device %(device)s up on %(agent_id)s"), locals()) port = ovs_db_v2.get_port(device) if port: if port["status"] != q_const.PORT_STATUS_ACTIVE: ovs_db_v2.set_port_status(port["id"], q_const.PORT_STATUS_ACTIVE) else: LOG.debug(_("%s can not be found in database"), device)
def update_device_up(self, rpc_context, **kwargs): """Device is up on agent.""" agent_id = kwargs.get('agent_id') device = kwargs.get('device') LOG.debug(_("Device %(device)s up on %(agent_id)s"), {'device': device, 'agent_id': agent_id}) port = ovs_db_v2.get_port(device) if port: if port['status'] != q_const.PORT_STATUS_ACTIVE: ovs_db_v2.set_port_status(port['id'], q_const.PORT_STATUS_ACTIVE) else: LOG.debug(_("%s can not be found in database"), device)
def update_device_up(self, rpc_context, **kwargs): """Device is up on agent""" agent_id = kwargs.get('agent_id') device = kwargs.get('device') LOG.debug(_("Device %(device)s up on %(agent_id)s"), locals()) port = ovs_db_v2.get_port(device) if port: if port['status'] != q_const.PORT_STATUS_ACTIVE: ovs_db_v2.set_port_status(port['id'], q_const.PORT_STATUS_ACTIVE) else: LOG.debug(_("%s can not be found in database"), device)
def update_device_down(self, rpc_context, **kwargs): """Device no longer exists on agent""" # (TODO) garyk - live migration and port status agent_id = kwargs.get('agent_id') device = kwargs.get('device') LOG.debug("Device %s no longer exists on %s", device, agent_id) port = ovs_db_v2.get_port(device) if port: entry = {'device': device, 'exists': True} # Set port status to DOWN ovs_db_v2.set_port_status(port['id'], q_const.PORT_STATUS_DOWN) else: entry = {'device': device, 'exists': False} LOG.debug("%s can not be found in database", device) return entry
def update_device_down(self, rpc_context, **kwargs): """Device no longer exists on agent""" # (TODO) garyk - live migration and port status agent_id = kwargs.get("agent_id") device = kwargs.get("device") LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"), locals()) port = ovs_db_v2.get_port(device) if port: entry = {"device": device, "exists": True} if port["status"] != q_const.PORT_STATUS_DOWN: # Set port status to DOWN ovs_db_v2.set_port_status(port["id"], q_const.PORT_STATUS_DOWN) else: entry = {"device": device, "exists": False} LOG.debug(_("%s can not be found in database"), device) return entry
def update_device_down(self, rpc_context, **kwargs): """Device no longer exists on agent.""" # TODO(garyk) - live migration and port status agent_id = kwargs.get('agent_id') device = kwargs.get('device') LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"), locals()) port = ovs_db_v2.get_port(device) if port: entry = {'device': device, 'exists': True} if port['status'] != q_const.PORT_STATUS_DOWN: # Set port status to DOWN ovs_db_v2.set_port_status(port['id'], q_const.PORT_STATUS_DOWN) else: entry = {'device': device, 'exists': False} LOG.debug(_("%s can not be found in database"), device) return entry
def get_device_details(self, context, **kwargs): """Agent requests device details""" agent_id = kwargs.get('agent_id') device = kwargs.get('device') LOG.debug("Device %s details requested from %s", device, agent_id) port = ovs_db_v2.get_port(device) if port: vlan_id = ovs_db_v2.get_vlan(port['network_id']) entry = {'device': device, 'vlan_id': vlan_id, 'network_id': port['network_id'], 'port_id': port['id'], 'admin_state_up': port['admin_state_up']} # Set the port status to UP ovs_db_v2.set_port_status(port['id'], api_common.PORT_STATUS_UP) else: entry = {'device': device} LOG.debug("%s can not be found in database", device) return entry
def update_device_down(self, rpc_context, **kwargs): """Device no longer exists on agent.""" # TODO(garyk) - live migration and port status agent_id = kwargs.get('agent_id') device = kwargs.get('device') LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"), { 'device': device, 'agent_id': agent_id }) port = ovs_db_v2.get_port(device) if port: entry = {'device': device, 'exists': True} if port['status'] != q_const.PORT_STATUS_DOWN: # Set port status to DOWN ovs_db_v2.set_port_status(port['id'], q_const.PORT_STATUS_DOWN) else: entry = {'device': device, 'exists': False} LOG.debug(_("%s can not be found in database"), device) return entry
def get_device_details(self, rpc_context, **kwargs): """Agent requests device details""" agent_id = kwargs.get('agent_id') device = kwargs.get('device') LOG.debug("Device %s details requested from %s", device, agent_id) port = ovs_db_v2.get_port(device) if port: binding = ovs_db_v2.get_network_binding(None, port['network_id']) entry = {'device': device, 'network_id': port['network_id'], 'port_id': port['id'], 'admin_state_up': port['admin_state_up'], 'network_type': binding.network_type, 'segmentation_id': binding.segmentation_id, 'physical_network': binding.physical_network} # Set the port status to UP ovs_db_v2.set_port_status(port['id'], q_const.PORT_STATUS_ACTIVE) else: entry = {'device': device} LOG.debug("%s can not be found in database", device) return entry
def get_device_details(self, rpc_context, **kwargs): """Agent requests device details.""" agent_id = kwargs.get('agent_id') device = kwargs.get('device') LOG.debug(_("Device %(device)s details requested from %(agent_id)s"), locals()) port = ovs_db_v2.get_port(device) if port: binding = ovs_db_v2.get_network_binding(None, port['network_id']) entry = {'device': device, 'network_id': port['network_id'], 'port_id': port['id'], 'admin_state_up': port['admin_state_up'], 'network_type': binding.network_type, 'segmentation_id': binding.segmentation_id, 'physical_network': binding.physical_network} new_status = (q_const.PORT_STATUS_ACTIVE if port['admin_state_up'] else q_const.PORT_STATUS_DOWN) if port['status'] != new_status: ovs_db_v2.set_port_status(port['id'], new_status) else: entry = {'device': device} LOG.debug(_("%s can not be found in database"), device) return entry
def get_device_details(self, rpc_context, **kwargs): """Agent requests device details""" agent_id = kwargs.get("agent_id") device = kwargs.get("device") LOG.debug(_("Device %(device)s details requested from %(agent_id)s"), locals()) port = ovs_db_v2.get_port(device) if port: binding = ovs_db_v2.get_network_binding(None, port["network_id"]) entry = { "device": device, "network_id": port["network_id"], "port_id": port["id"], "admin_state_up": port["admin_state_up"], "network_type": binding.network_type, "segmentation_id": binding.segmentation_id, "physical_network": binding.physical_network, } new_status = q_const.PORT_STATUS_ACTIVE if port["admin_state_up"] else q_const.PORT_STATUS_DOWN if port["status"] != new_status: ovs_db_v2.set_port_status(port["id"], new_status) else: entry = {"device": device} LOG.debug(_("%s can not be found in database"), device) return entry