Ejemplo n.º 1
0
 def handle(self, request, data):
     try:
         LOG.info('Detaching port %s' % data['port'])
         api.quantum_detach_port(request, data['network'], data['port'])
     except Exception, e:
         messages.error(request,
             _('Unable to detach port %(port)s: %(message)s') %
             {"port": data['port'], "message": e.message})
Ejemplo n.º 2
0
 def handle(self, request, data):
     try:
         LOG.info('Detaching port %s' % data['port'])
         api.quantum_detach_port(request, data['network'], data['port'])
     except Exception, e:
         if not hasattr(e, 'message'):
             e.message = str(e)
         messages.error(request,
             _('Unable to detach port %(port)s: %(message)s') %
             {"port": data['port'], "message": e.message})
Ejemplo n.º 3
0
    def test_port_detach(self):
        self.mox.StubOutWithMock(api, "quantum_detach_port")
        api.quantum_detach_port(IsA(http.HttpRequest),
                                'n1', 'p1').AndReturn(True)

        formData = {'port': 'p1',
                    'network': 'n1',
                    'method': 'DetachPort'}

        self.mox.StubOutWithMock(messages, 'success')
        messages.success(IgnoreArg(), IsA(basestring))

        res = self.client.post(reverse('horizon:nova:networks:detail',
                                             args=["n1"]),
                               formData)
Ejemplo n.º 4
0
    def test_port_detach(self):
        self.mox.StubOutWithMock(api, "quantum_detach_port")
        api.quantum_detach_port(IsA(http.HttpRequest),
                                'n1', 'p1').AndReturn(True)

        formData = {'port': 'p1',
                    'network': 'n1',
                    'method': 'DetachPort'}

        self.mox.StubOutWithMock(messages, 'success')
        messages.success(IgnoreArg(), IsA(basestring))

        self.mox.ReplayAll()

        res = self.client.post(reverse('horizon:nova:networks:detail',
                                             args=["n1"]),
                               formData)