Beispiel #1
0
    def handle(self, request, data):
        network_name = data['name']

        try:
            LOG.info('Creating network %s ' % network_name)
            send_data = {'network': {'name': '%s' % network_name}}
            api.quantum_create_network(request, send_data)
        except Exception, e:
            messages.error(request,
                           _('Unable to create network %(network)s: %(msg)s') %
                           {"network": network_name, "msg": e.message})
            return shortcuts.redirect(request.build_absolute_uri())
Beispiel #2
0
    def handle(self, request, data):
        network_name = data['name']

        try:
            LOG.info('Creating network %s ' % network_name)
            send_data = {'network': {'name': '%s' % network_name}}
            api.quantum_create_network(request, send_data)
        except Exception, e:
            if not hasattr(e, 'message'):
                e.message = str(e)
            messages.error(request,
                           _('Unable to create network %(network)s: %(msg)s') %
                           {"network": network_name, "msg": e.message})
            return shortcuts.redirect(request.build_absolute_uri())
Beispiel #3
0
    def test_network_create(self):
        self.mox.StubOutWithMock(api, "quantum_create_network")
        api.quantum_create_network(IsA(http.HttpRequest), dict).AndReturn(True)

        self.mox.ReplayAll()

        formData = {'name': 'Test',
                    'method': 'CreateNetwork'}

        res = self.client.post(reverse('horizon:nova:networks:create'),
                               formData)

        self.assertRedirectsNoFollow(res,
                                     reverse('horizon:nova:networks:index'))