Merge "delete interface attach/detach commands"

This commit is contained in:
Jenkins
2015-11-29 07:25:30 +00:00
committed by Gerrit Code Review
3 changed files with 0 additions and 61 deletions

View File

@@ -113,8 +113,6 @@ COMMAND_V1 = {
'device-show': device.ShowDevice, 'device-show': device.ShowDevice,
'device-update': device.UpdateDevice, 'device-update': device.UpdateDevice,
'device-delete': device.DeleteDevice, 'device-delete': device.DeleteDevice,
'interface-attach': device.AttachInterface,
'interface-detach': device.DetachInterface,
# MANO lingo # MANO lingo
'vnfd-create': vnfd.CreateVNFD, 'vnfd-create': vnfd.CreateVNFD,

View File

@@ -19,9 +19,6 @@
# #
# @author: Isaku Yamahata, Intel # @author: Isaku Yamahata, Intel
import abc
import six
from tackerclient.common import exceptions from tackerclient.common import exceptions
from tackerclient.openstack.common.gettextutils import _ from tackerclient.openstack.common.gettextutils import _
from tackerclient.tacker import v1_0 as tackerV10 from tackerclient.tacker import v1_0 as tackerV10
@@ -142,49 +139,3 @@ class DeleteDevice(tackerV10.DeleteCommand):
"""Delete a given Device.""" """Delete a given Device."""
resource = _DEVICE resource = _DEVICE
@six.add_metaclass(abc.ABCMeta)
class _XtachInterface(tackerV10.UpdateCommand):
resource = _DEVICE
@abc.abstractmethod
def call_api(self, tacker_client, device_id, body):
pass
def args2body(self, parsed_args):
body = {
'port_id': parsed_args.port_id,
}
tackerV10.update_dict(parsed_args, body, [])
return body
def get_parser(self, prog_name):
parser = super(_XtachInterface, self).get_parser(prog_name)
parser.add_argument('port_id', metavar='PORT',
help=_('port to attach/detach'))
self.add_known_arguments(parser)
return parser
def run(self, parsed_args):
tacker_client = self.get_client()
tacker_client.format = parsed_args.request_format
body = self.args2body(parsed_args)
_id = tackerV10.find_resourceid_by_name_or_id(tacker_client,
self.resource,
parsed_args.id)
self.call_api(tacker_client, _id, body)
class AttachInterface(_XtachInterface):
"""Attach a network interface to a server."""
def call_api(self, tacker_client, device_id, body):
return tacker_client.attach_interface(device_id, body)
class DetachInterface(_XtachInterface):
"""Detach a network interface from a server."""
def call_api(self, tacker_client, device_id, body):
return tacker_client.detach_interface(device_id, body)

View File

@@ -338,8 +338,6 @@ class Client(ClientBase):
device_template_path = '/device-templates/%s' device_template_path = '/device-templates/%s'
devices_path = '/devices' devices_path = '/devices'
device_path = '/devices/%s' device_path = '/devices/%s'
interface_attach_path = '/devices/%s/attach_interface'
interface_detach_path = '/devices/%s/detach_interface'
vnfds_path = '/vnfds' vnfds_path = '/vnfds'
vnfd_path = '/vnfds/%s' vnfd_path = '/vnfds/%s'
@@ -400,14 +398,6 @@ class Client(ClientBase):
def delete_device(self, device): def delete_device(self, device):
return self.delete(self.device_path % device) return self.delete(self.device_path % device)
@APIParamsCall
def attach_interface(self, device, body=None):
return self.put(self.attach_interface_path % device, body)
@APIParamsCall
def detach_interface(self, device, body=None):
return self.put(self.detach_interface_path % device, body)
_VNFD = "vnfd" _VNFD = "vnfd"
@APIParamsCall @APIParamsCall