Esempio n. 1
0
    def delete(self, switch_id):
        """Delete this Switch."""
        # ensure switch exists before deleting

        switches = list(self.conn.get_switches(switch_id=switch_id))

        if len(switches) < 1:
            raise EntityNotFound(_('Switch'), switch_id)

        switch = switches[0]
        #UCM Configuration Start
        record = {'name': {'type': constants.DATA_TYPES['string'], 'value': str(switch.name)},
                  'dmpath': constants.PATH_PREFIX + '.' + self.dmpath}
        try:
            ret_val = _ucm.delete_record(record)
            LOG.debug(_("return value = %s"), str(ret_val))
            if ret_val != 0:
                error = _("Unable to delete Switch record from UCM")
                response.translatable_error = error
                raise wsme.exc.ClientSideError(unicode(error))
        except UCMException, msg:
            LOG.info(_("UCM Exception raised. %s"), msg)
            error = _("Unable to delete Switch record from UCM")
            response.translatable_error = error
            raise wsme.exc.ClientSideError(unicode(error))
Esempio n. 2
0
    def delete(self, service_id):
        """Delete this Network Service."""
        # ensure service exists before deleting
        services = list(self.conn.get_services(service_id=service_id))

        if len(services) < 1:
            services = list(self.conn.get_services(name=service_id))
            if len(services) < 1:
                raise EntityNotFound(_('Service'), service_id)
            else:
                self.conn.delete_service(name=service_id)
        else:
            self.conn.delete_service(service_id=service_id)

        #UCM Configuration Start
        service = services[0]
        record = {'name': {'type': constants.DATA_TYPES['string'], 'value': str(service.name)},
                  'tenant': {'type': constants.DATA_TYPES['string'], 'value': str(service.tenant)},
                  'dmpath': constants.PATH_PREFIX + '.' + self.dmpath}
        try:
            ret_val = ucm.delete_record(record)
            if ret_val != 0:
                error = _("Unable to delete service record from UCM")
                response.translatable_error = error
                raise wsme.exc.ClientSideError(unicode(error))
        except ucm.UCMException, msg:
            LOG.info(_("UCM Exception raised. %s"), msg)
            error = _("Unable to delete service record from UCM")
            response.translatable_error = error
            raise wsme.exc.ClientSideError(unicode(error))
Esempio n. 3
0
    def delete(self, datapath_id):
        """Delete this datapath."""
        # ensure datapath exists before deleting

        datapaths = list(self.conn.get_datapaths(datapath_id=datapath_id))

        if len(datapaths) < 1:
            raise EntityNotFound(_('Datapath'), datapath_id)

        #UCM Configuration Start
        record = {'datapathid': {'type': constants.DATA_TYPES['uint64'], 'value': str(datapath_id)},
                  'dmpath': constants.PATH_PREFIX + '.' + self.dmpath}
        try:
            ret_val = _ucm.delete_record(record)
            LOG.debug(_("return value = %s"), str(ret_val))
            if ret_val != 0:
                error = _("Unable to delete datapath record from UCM")
                response.translatable_error = error
                raise wsme.exc.ClientSideError(unicode(error))
        except UCMException, msg:
            LOG.info(_("UCM Exception raised. %s"), msg)
            error = _("Unable to delete datapath record from UCM")
            response.translatable_error = error
            raise wsme.exc.ClientSideError(unicode(error))
Esempio n. 4
0
    def delete(self, nw_id):
        """Delete this Virtual Network."""
        # ensure virtual network exists before deleting

        virtualnetworks = list(self.conn.get_virtualnetworks(nw_id=nw_id))

        if len(virtualnetworks) < 1:
            raise EntityNotFound(_('Virtual Network'), nw_id)

        #UCM Configuration Start
        record = {'name': {'type': constants.DATA_TYPES['string'], 'value': str(virtualnetworks[0].name)},
                  'dmpath': constants.PATH_PREFIX + '.' + self.dmpath}
        try:
            ret_val = _ucm.delete_record(record)
            LOG.debug(_("return value = %s"), str(ret_val))
            if ret_val != 0:
                error = _("Unable to delete Virtual Network record from UCM")
                response.translatable_error = error
                raise wsme.exc.ClientSideError(unicode(error))
        except UCMException, msg:
            LOG.info(_("UCM Exception raised. %s"), msg)
            error = _("Unable to delete Virtual Network record from UCM")
            response.translatable_error = error
            raise wsme.exc.ClientSideError(unicode(error))