def _get_port_security_binding(self, context, port_id): try: query = self._model_query(context, PortSecurityBinding) binding = query.filter( PortSecurityBinding.port_id == port_id).one() except exc.NoResultFound: raise psec.PortSecurityBindingNotFound() return binding[psec.PORTSECURITY]
def _update_network_security_binding(self, context, network_id, port_security_enabled): try: query = self._model_query(context, NetworkSecurityBinding) binding = query.filter( NetworkSecurityBinding.network_id == network_id).one() binding.update({psec.PORTSECURITY: port_security_enabled}) except exc.NoResultFound: raise psec.PortSecurityBindingNotFound()