]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Merge tag '2014.2.b1' into debian/juno
authorgustavo panizzo <gfa@zumbi.com.ar>
Mon, 30 Jun 2014 21:13:31 +0000 (18:13 -0300)
committergustavo panizzo <gfa@zumbi.com.ar>
Mon, 30 Jun 2014 21:13:31 +0000 (18:13 -0300)
Neutron juno-1 milestone (2014.2.b1)

Conflicts:
neutron/locale/ar/LC_MESSAGES/neutron.po
neutron/locale/bg_BG/LC_MESSAGES/neutron.po
neutron/locale/bn_IN/LC_MESSAGES/neutron.po
neutron/locale/bs/LC_MESSAGES/neutron.po
neutron/locale/ca/LC_MESSAGES/neutron.po
neutron/locale/cs/LC_MESSAGES/neutron.po
neutron/locale/da/LC_MESSAGES/neutron.po
neutron/locale/de/LC_MESSAGES/neutron.po
neutron/locale/el/LC_MESSAGES/neutron.po
neutron/locale/en_AU/LC_MESSAGES/neutron.po
neutron/locale/en_GB/LC_MESSAGES/neutron.po
neutron/locale/es/LC_MESSAGES/neutron.po
neutron/locale/es_MX/LC_MESSAGES/neutron.po
neutron/locale/eu/LC_MESSAGES/neutron.po
neutron/locale/eu_ES/LC_MESSAGES/neutron.po
neutron/locale/fa/LC_MESSAGES/neutron.po
neutron/locale/fi_FI/LC_MESSAGES/neutron.po
neutron/locale/fil/LC_MESSAGES/neutron.po
neutron/locale/fr/LC_MESSAGES/neutron.po
neutron/locale/gl/LC_MESSAGES/neutron.po
neutron/locale/he/LC_MESSAGES/neutron.po
neutron/locale/he_IL/LC_MESSAGES/neutron.po
neutron/locale/hi/LC_MESSAGES/neutron.po
neutron/locale/hr/LC_MESSAGES/neutron.po
neutron/locale/hu/LC_MESSAGES/neutron.po
neutron/locale/id/LC_MESSAGES/neutron.po
neutron/locale/is_IS/LC_MESSAGES/neutron.po
neutron/locale/it/LC_MESSAGES/neutron.po
neutron/locale/it_IT/LC_MESSAGES/neutron.po
neutron/locale/ja/LC_MESSAGES/neutron.po
neutron/locale/ka_GE/LC_MESSAGES/neutron.po
neutron/locale/km/LC_MESSAGES/neutron.po
neutron/locale/kn/LC_MESSAGES/neutron.po
neutron/locale/ko/LC_MESSAGES/neutron.po
neutron/locale/ko_KR/LC_MESSAGES/neutron.po
neutron/locale/ml_IN/LC_MESSAGES/neutron.po
neutron/locale/mr_IN/LC_MESSAGES/neutron.po
neutron/locale/ms/LC_MESSAGES/neutron.po
neutron/locale/nb/LC_MESSAGES/neutron.po
neutron/locale/ne/LC_MESSAGES/neutron.po
neutron/locale/nl_NL/LC_MESSAGES/neutron.po
neutron/locale/pa_IN/LC_MESSAGES/neutron.po
neutron/locale/pl_PL/LC_MESSAGES/neutron.po
neutron/locale/pt/LC_MESSAGES/neutron.po
neutron/locale/pt_BR/LC_MESSAGES/neutron.po
neutron/locale/ro/LC_MESSAGES/neutron.po
neutron/locale/ru/LC_MESSAGES/neutron.po
neutron/locale/ru_RU/LC_MESSAGES/neutron.po
neutron/locale/sk/LC_MESSAGES/neutron.po
neutron/locale/sl_SI/LC_MESSAGES/neutron.po
neutron/locale/sq/LC_MESSAGES/neutron.po
neutron/locale/sr/LC_MESSAGES/neutron.po
neutron/locale/sv/LC_MESSAGES/neutron.po
neutron/locale/sw_KE/LC_MESSAGES/neutron.po
neutron/locale/ta/LC_MESSAGES/neutron.po
neutron/locale/te_IN/LC_MESSAGES/neutron.po
neutron/locale/tl/LC_MESSAGES/neutron.po
neutron/locale/tl_PH/LC_MESSAGES/neutron.po
neutron/locale/tr_TR/LC_MESSAGES/neutron.po
neutron/locale/uk/LC_MESSAGES/neutron.po
neutron/locale/ur/LC_MESSAGES/neutron.po
neutron/locale/vi_VN/LC_MESSAGES/neutron.po
neutron/locale/zh_CN/LC_MESSAGES/neutron.po
neutron/locale/zh_HK/LC_MESSAGES/neutron.po
neutron/locale/zh_TW/LC_MESSAGES/neutron.po
neutron/tests/unit/vmware/extensions/test_networkgw.py

1  2 
neutron/api/v2/attributes.py
neutron/db/db_base_plugin_v2.py
neutron/plugins/vmware/nsxlib/lsn.py
neutron/tests/unit/services/vpn/device_drivers/test_cisco_ipsec.py
neutron/tests/unit/test_db_plugin.py
neutron/tests/unit/test_l3_agent.py
neutron/tests/unit/test_security_groups_rpc.py

Simple merge
Simple merge
index bea677a5d9b81ffb33e845b07f51ea02482e9161,993f9d5bb70b0256e5df308f4ba06041946bedf1..ab2eeb7dfa8e140aa3d891efa1881d2d845ec6ff
@@@ -191,25 -193,25 +193,29 @@@ def _lsn_configure_action
  
  def _lsn_port_configure_action(
      cluster, lsn_id, lsn_port_id, action, is_enabled, obj):
-     do_request(HTTP_PUT,
-                _build_uri_path(LSERVICESNODE_RESOURCE,
-                                resource_id=lsn_id,
-                                extra_action=action),
-                json.dumps({"enabled": is_enabled}),
-                cluster=cluster)
-     do_request(HTTP_PUT,
-                _build_uri_path(LSERVICESNODEPORT_RESOURCE,
-                                parent_resource_id=lsn_id,
-                                resource_id=lsn_port_id,
-                                extra_action=action),
-                json.dumps(obj),
-                cluster=cluster)
+     nsxlib.do_request(HTTP_PUT,
+                       nsxlib._build_uri_path(LSERVICESNODE_RESOURCE,
+                                              resource_id=lsn_id,
+                                              extra_action=action),
+                       json.dumps({"enabled": is_enabled}),
+                       cluster=cluster)
+     nsxlib.do_request(HTTP_PUT,
+                       nsxlib._build_uri_path(LSERVICESNODEPORT_RESOURCE,
+                                              parent_resource_id=lsn_id,
+                                              resource_id=lsn_port_id,
+                                              extra_action=action),
+                       json.dumps(obj),
+                       cluster=cluster)
+ def _get_opts(name, value):
+     return {"name": name, "value": str(value)}
  
  
 +def _get_opts(name, value):
 +    return {"name": name, "value": str(value)}
 +
 +
  def lsn_port_dhcp_configure(
          cluster, lsn_id, lsn_port_id, is_enabled=True, dhcp_options=None):
      dhcp_options = dhcp_options or {}
index 2261e044283a99f98aa0a8ea589d069523950286,562416bd412f3df95cf10e5475629da5b98888c5..eece579919c638f8d3542f6382fad5ffc571981a
@@@ -508,35 -596,38 +596,63 @@@ class TestCiscoCsrIPsecDeviceDriverSync
                                                     u'123', conn_data)
          self.assertIsNotNone(connection)
          self.assertFalse(connection.is_dirty)
+         self.assertEqual(1, self.conn_create.call_count)
          self.assertFalse(connection.is_admin_up)
          self.assertTrue(connection.forced_down)
-         self.assertFalse(self.conn_create.called)
+         self.assertEqual(1, self.admin_state.call_count)
+     def test_update_connection_admin_up(self):
+         """Connection updated to admin up state - record."""
+         # Make existing service, and connection that was admin down
+         conn_data = copy.deepcopy(self.conn1_data)
+         conn_data.update({u'status': constants.DOWN, u'admin_state_up': False})
+         service_data = {u'id': u'123',
+                         u'status': constants.DOWN,
+                         u'external_ip': u'1.1.1.1',
+                         u'admin_state_up': True,
+                         u'ipsec_conns': [conn_data]}
+         self.driver.update_service(self.context, service_data)
+         # Simulate that notification of connection update received
+         self.driver.mark_existing_connections_as_dirty()
+         # Now simulate that the notification shows the connection admin up
+         new_conn_data = copy.deepcopy(conn_data)
+         new_conn_data[u'admin_state_up'] = True
+         connection = self.driver.update_connection(self.context,
+                                                    u'123', new_conn_data)
+         self.assertFalse(connection.is_dirty)
+         self.assertEqual(u'Tunnel0', connection.tunnel)
+         self.assertEqual(constants.DOWN, connection.last_status)
+         self.assertTrue(connection.is_admin_up)
+         self.assertFalse(connection.forced_down)
+         self.assertEqual(2, self.admin_state.call_count)
  
 +    def test_update_connection_admin_up(self):
 +        """Connection updated to admin up state - record."""
 +        # Make existing service, and connection that was admin down
 +        conn_data = {u'id': '1', u'status': constants.DOWN,
 +                     u'admin_state_up': False,
 +                     u'cisco': {u'site_conn_id': u'Tunnel0'}}
 +        service_data = {u'id': u'123',
 +                        u'status': constants.DOWN,
 +                        u'external_ip': u'1.1.1.1',
 +                        u'admin_state_up': True,
 +                        u'ipsec_conns': [conn_data]}
 +        self.driver.update_service(self.context, service_data)
 +        self.driver.mark_existing_connections_as_dirty()
 +        # Now simulate that the notification shows the connection admin up
 +        conn_data[u'admin_state_up'] = True
 +        conn_data[u'status'] = constants.DOWN
 +
 +        connection = self.driver.update_connection(self.context,
 +                                                   u'123', conn_data)
 +        self.assertFalse(connection.is_dirty)
 +        self.assertFalse(connection.forced_down)
 +        self.assertEqual(u'Tunnel0', connection.tunnel)
 +        self.assertEqual(constants.DOWN, connection.last_status)
 +        self.assertEqual(1, self.conn_create.call_count)
 +
      def test_update_for_vpn_service_create(self):
          """Creation of new IPSec connection on new VPN service - create.
  
Simple merge
index ec272ef6a939df480672b6773efb19e895591ae6,841425dfb0b7da00c6be87e952eb71518a15dc03..b6003df90b09951761444d0f553c38a6f1631654
@@@ -647,16 -649,17 +649,110 @@@ class TestBasicRouterOperations(base.Ba
                             if r not in orig_nat_rules]
          self.assertEqual(len(nat_rules_delta), 1)
          self._verify_snat_rules(nat_rules_delta, router)
-         self.send_arp.assert_called_once()
+         # send_arp is called both times process_router is called
+         self.assertEqual(self.send_arp.call_count, 2)
+     def test_process_ipv6_only_gw(self):
+         agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
+         router = self._prepare_router_data(ip_version=6)
+         # Get NAT rules without the gw_port
+         gw_port = router['gw_port']
+         router['gw_port'] = None
+         ri = l3_agent.RouterInfo(router['id'], self.conf.root_helper,
+                                  self.conf.use_namespaces, router=router)
++        agent.external_gateway_added = mock.Mock()
++        agent.process_router(ri)
++        orig_nat_rules = ri.iptables_manager.ipv4['nat'].rules[:]
++
++        # Get NAT rules with the gw_port
++        router['gw_port'] = gw_port
++        ri = l3_agent.RouterInfo(router['id'], self.conf.root_helper,
++                                 self.conf.use_namespaces, router=router)
++        with mock.patch.object(
++                agent,
++                'external_gateway_nat_rules') as external_gateway_nat_rules:
++            agent.process_router(ri)
++            new_nat_rules = ri.iptables_manager.ipv4['nat'].rules[:]
++
++            # There should be no change with the NAT rules
++            self.assertFalse(external_gateway_nat_rules.called)
++            self.assertEqual(orig_nat_rules, new_nat_rules)
++
++    def test_process_router_ipv6_interface_added(self):
++        agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
++        router = self._prepare_router_data()
++        ri = l3_agent.RouterInfo(router['id'], self.conf.root_helper,
++                                 self.conf.use_namespaces, router=router)
++        agent.external_gateway_added = mock.Mock()
++        # Process with NAT
++        agent.process_router(ri)
++        orig_nat_rules = ri.iptables_manager.ipv4['nat'].rules[:]
++        # Add an IPv6 interface and reprocess
++        router[l3_constants.INTERFACE_KEY].append(
++            {'id': _uuid(),
++             'network_id': _uuid(),
++             'admin_state_up': True,
++             'fixed_ips': [{'ip_address': 'fd00::2',
++                            'subnet_id': _uuid()}],
++             'mac_address': 'ca:fe:de:ad:be:ef',
++             'subnet': {'cidr': 'fd00::/64',
++                        'gateway_ip': 'fd00::1'}})
++        # Reassign the router object to RouterInfo
++        ri.router = router
++        agent.process_router(ri)
++        # For some reason set logic does not work well with
++        # IpTablesRule instances
++        nat_rules_delta = [r for r in ri.iptables_manager.ipv4['nat'].rules
++                           if r not in orig_nat_rules]
++        self.assertFalse(nat_rules_delta)
++
++    def test_process_router_ipv6v4_interface_added(self):
++        agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
++        router = self._prepare_router_data()
++        ri = l3_agent.RouterInfo(router['id'], self.conf.root_helper,
++                                 self.conf.use_namespaces, router=router)
++        agent.external_gateway_added = mock.Mock()
++        # Process with NAT
++        agent.process_router(ri)
++        orig_nat_rules = ri.iptables_manager.ipv4['nat'].rules[:]
++        # Add an IPv4 and IPv6 interface and reprocess
++        router[l3_constants.INTERFACE_KEY].append(
++            {'id': _uuid(),
++             'network_id': _uuid(),
++             'admin_state_up': True,
++             'fixed_ips': [{'ip_address': '35.4.1.4',
++                            'subnet_id': _uuid()}],
++             'mac_address': 'ca:fe:de:ad:be:ef',
++             'subnet': {'cidr': '35.4.1.0/24',
++                        'gateway_ip': '35.4.1.1'}})
++
++        router[l3_constants.INTERFACE_KEY].append(
++            {'id': _uuid(),
++             'network_id': _uuid(),
++             'admin_state_up': True,
++             'fixed_ips': [{'ip_address': 'fd00::2',
++                            'subnet_id': _uuid()}],
++             'mac_address': 'ca:fe:de:ad:be:ef',
++             'subnet': {'cidr': 'fd00::/64',
++                        'gateway_ip': 'fd00::1'}})
++        # Reassign the router object to RouterInfo
++        ri.router = router
++        agent.process_router(ri)
++        # For some reason set logic does not work well with
++        # IpTablesRule instances
++        nat_rules_delta = [r for r in ri.iptables_manager.ipv4['nat'].rules
++                           if r not in orig_nat_rules]
++        self.assertEqual(1, len(nat_rules_delta))
++        self._verify_snat_rules(nat_rules_delta, router)
 +
 +    def test_process_ipv6_only_gw(self):
 +        agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
 +        router = self._prepare_router_data(ip_version=6)
 +        # Get NAT rules without the gw_port
 +        gw_port = router['gw_port']
 +        router['gw_port'] = None
 +        ri = l3_agent.RouterInfo(router['id'], self.conf.root_helper,
 +                                 self.conf.use_namespaces, router=router)
          agent.external_gateway_added = mock.Mock()
          agent.process_router(ri)
          orig_nat_rules = ri.iptables_manager.ipv4['nat'].rules[:]
index b3d71da09b2a4a4323c27d5fbe1a70b0c472ba59,12b6f6ee9bac08097ce6f0e47dfc44005b510507..10ba02c314ce33b62eb8144f4c970616e36b83b8
@@@ -502,20 -768,20 +768,31 @@@ class SGAgentRpcCallBackMixinTestCase(b
      def test_security_groups_provider_updated(self):
          self.rpc.security_groups_provider_updated(None)
          self.rpc.sg_agent.assert_has_calls(
-             [call.security_groups_provider_updated()])
+             [mock.call.security_groups_provider_updated()])
+ class SecurityGroupAgentRpcTestCaseForNoneDriver(base.BaseTestCase):
+     def test_init_firewall_with_none_driver(self):
+         cfg.CONF.set_override(
+             'enable_security_group', False,
+             group='SECURITYGROUP')
+         agent = sg_rpc.SecurityGroupAgentRpcMixin()
+         agent.init_firewall()
+         self.assertEqual(agent.firewall.__class__.__name__,
+                          'NoopFirewallDriver')
  
  
 +class SecurityGroupAgentRpcTestCaseForNoneDriver(base.BaseTestCase):
 +    def test_init_firewall_with_none_driver(self):
 +        cfg.CONF.set_override(
 +            'enable_security_group', False,
 +            group='SECURITYGROUP')
 +        agent = sg_rpc.SecurityGroupAgentRpcMixin()
 +        agent.init_firewall()
 +        self.assertEqual(agent.firewall.__class__.__name__,
 +                         'NoopFirewallDriver')
 +
 +
  class SecurityGroupAgentRpcTestCase(base.BaseTestCase):
      def setUp(self, defer_refresh_firewall=False):
          super(SecurityGroupAgentRpcTestCase, self).setUp()