예제 #1
0
    def test_network_rename(self):
        self.mox.StubOutWithMock(api, "quantum_update_network")
        api.quantum_update_network(IsA(http.HttpRequest), 'n1',
                                   dict).AndReturn(True)

        self.mox.StubOutWithMock(api, 'quantum_list_networks')
        api.quantum_list_networks(IsA(http.HttpRequest)).\
                                        AndReturn(self.network)

        self.mox.StubOutWithMock(api, 'quantum_network_details')
        api.quantum_network_details(IsA(http.HttpRequest),
                                    'n1').AndReturn(self.network_details)

        self.mox.StubOutWithMock(api, 'quantum_list_ports')
        api.quantum_list_ports(IsA(http.HttpRequest),
                               'n1').AndReturn(self.ports)

        self.mox.StubOutWithMock(api, 'quantum_port_attachment')
        api.quantum_port_attachment(IsA(http.HttpRequest), 'n1',
                                    'p1').AndReturn(self.port_attachment)

        self.mox.ReplayAll()

        formData = {'new_name': 'Test1', 'method': 'RenameNetwork'}

        res = self.client.post(
            reverse('dash_network_rename',
                    args=[self.request.user.tenant_id, "n1"]), formData)
    def test_network_rename(self):
        self.mox.StubOutWithMock(api, "quantum_update_network")
        api.quantum_update_network(IsA(http.HttpRequest),
                                   'n1', dict).AndReturn(True)

        self.mox.StubOutWithMock(api, 'quantum_list_networks')
        api.quantum_list_networks(IsA(http.HttpRequest)).\
                                        AndReturn(self.network)

        self.mox.StubOutWithMock(api, 'quantum_network_details')
        api.quantum_network_details(IsA(http.HttpRequest),
                                    'n1').AndReturn(self.network_details)

        self.mox.StubOutWithMock(api, 'quantum_list_ports')
        api.quantum_list_ports(IsA(http.HttpRequest),
                               'n1').AndReturn(self.ports)

        self.mox.StubOutWithMock(api, 'quantum_port_attachment')
        api.quantum_port_attachment(IsA(http.HttpRequest),
                                    'n1', 'p1').AndReturn(self.port_attachment)

        self.mox.ReplayAll()

        formData = {'new_name': 'Test1',
                    'method': 'RenameNetwork'}

        res = self.client.post(reverse('dash_network_rename',
                               args=[self.request.user.tenant, "n1"]),
                               formData)
예제 #3
0
파일: networks.py 프로젝트: Lezval/horizon
 def handle(self, request, data):
     try:
         LOG.info('Renaming network %s to %s' %
                  (data['network'], data['new_name']))
         send_data = {'network': {'name': '%s' % data['new_name']}}
         api.quantum_update_network(request, data['network'], send_data)
     except Exception, e:
         messages.error(request,
                 _('Unable to rename network %(network)s: %(msg)s') %
                 {"network": data['network'], "msg": e.message})
예제 #4
0
 def handle(self, request, data):
     try:
         LOG.info('Renaming network %s to %s' %
                  (data['network'], data['new_name']))
         send_data = {'network': {'name': '%s' % data['new_name']}}
         api.quantum_update_network(request, data['network'], send_data)
     except Exception, e:
         messages.error(request,
                        'Unable to rename network %s: %s' %
                        (data['network'], e.message,))
예제 #5
0
 def handle(self, request, data):
     try:
         LOG.info('Renaming network %s to %s' %
                  (data['network'], data['new_name']))
         send_data = {'network': {'name': '%s' % data['new_name']}}
         api.quantum_update_network(request, data['network'], send_data)
     except Exception, e:
         messages.error(
             request, 'Unable to rename network %s: %s' % (
                 data['network'],
                 e.message,
             ))
예제 #6
0
파일: networks.py 프로젝트: Lezval/horizon
 def handle(self, request, data):
     try:
         LOG.info('Renaming network %s to %s' %
                  (data['network'], data['new_name']))
         send_data = {'network': {'name': '%s' % data['new_name']}}
         api.quantum_update_network(request, data['network'], send_data)
     except Exception, e:
         messages.error(
             request,
             _('Unable to rename network %(network)s: %(msg)s') % {
                 "network": data['network'],
                 "msg": e.message
             })