~corey.bryant/ubuntu/trusty/neutron/lp1318721

« back to all changes in this revision

Viewing changes to neutron/tests/unit/db/firewall/test_db_firewall.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Corey Bryant
  • Date: 2014-10-06 09:15:06 UTC
  • mfrom: (28.1.4 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20141006091506-cesvev43moce4y74
Tags: 1:2014.1.3-0ubuntu1
[ Corey Bryant ]
* Resynchronize with stable/icehouse (4a0210e) (LP: #1377136):
  - [3a30d19] Deletes floating ip related connection states
  - [dd4b77f] Forbid regular users to reset admin-only attrs to default values
  - [dc2c893] Add delete operations for the ODL MechanismDriver
  - [b51e2c7] Add missing ml2 plugin to migration 1fcfc149aca4
  - [a17a500] Don't convert numeric protocol values to int
  - [3a85946] NSX: Optionally not enforce nat rule match length check
  - [645f984] Don't spawn metadata-proxy for non-isolated nets
  - [b464d89] Big Switch: Check for 'id' in port before lookup
  - [3116ffa] use TRUE in SQL for boolean var
  - [3520e66] call security_groups_member_updated in port_update
  - [50e1534] Don't allow user to set firewall rule with port and no protocol
  - [0061533] BSN: Add context to backend request for debugging
  - [6de6d61] Improve ODL ML2 Exception Handling
  - [2a4153d] Send network name and uuid to subnet create
  - [b5e3c9a] BSN: Allow concurrent reads to consistency DB
  - [b201432] Big Switch: Retry on 503 errors from backend
  - [f6c47ee] NSX: log request body to NSX as debug
  - [97d622a] Fix metadata agent's auth info caching
  - [255df45] NSX: Correct allowed_address_pair return value on create_port
  - [5bea041] Neutron should not use the neutronclient utils module for import_class
  - [d5314e2] Cisco N1kv plugin to send subtype on network profile creation
  - [f32d1ce] Pass object to policy when finding fields to strip
  - [8b5f6be] Call policy.init() once per API request
  - [9a6d811] Perform policy checks only once on list responses
  - [c48db90] Datacenter moid should not be tuple
  - [161d465] Allow unsharing a network used as gateway/floatingip
  - [9574a2f] Add support for router scheduling in Cisco N1kv Plugin
  - [6f54565] Fix func job hook script permission problems
  - [ea43103] Add hook scripts for the functional infra job
  - [8161cb7] Fixes Hyper-V agent issue on Hyper-V 2008 R2
  - [8e99cfd] Fixes Hyper-V issue due to ML2 RPC versioning
  - [69f9121] Ensure ip6tables are used only if ipv6 is enabled in kernel
  - [399b809] Remove explicit dependency on amqplib
  - [a872143] Clear entries in Cisco N1KV specific tables on rollback
  - [ad82fad] Verify ML2 type driver exists before calling del
  - [af2cc98] Big Switch: Only update hash header on success
  - [b1e5eec] Ignore variable column widths in ovsdb functional tests
  - [4a0210e] VMWare: don't notify on disassociate_floatingips()

Show diffs side-by-side

added added

removed removed

Lines of Context:
580
580
            for k, v in attrs.iteritems():
581
581
                self.assertEqual(firewall_rule['firewall_rule'][k], v)
582
582
 
 
583
    def test_create_firewall_rule_without_protocol_with_dport(self):
 
584
        attrs = self._get_test_firewall_rule_attrs()
 
585
        attrs['protocol'] = None
 
586
        attrs['source_port'] = None
 
587
        res = self._create_firewall_rule(self.fmt, **attrs)
 
588
        self.assertEqual(400, res.status_int)
 
589
 
 
590
    def test_create_firewall_rule_without_protocol_with_sport(self):
 
591
        attrs = self._get_test_firewall_rule_attrs()
 
592
        attrs['protocol'] = None
 
593
        attrs['destination_port'] = None
 
594
        res = self._create_firewall_rule(self.fmt, **attrs)
 
595
        self.assertEqual(400, res.status_int)
 
596
 
583
597
    def test_show_firewall_rule_with_fw_policy_not_associated(self):
584
598
        attrs = self._get_test_firewall_rule_attrs()
585
599
        with self.firewall_rule() as fw_rule:
675
689
            for k, v in attrs.iteritems():
676
690
                self.assertEqual(res['firewall_rule'][k], v)
677
691
 
 
692
    def test_update_firewall_rule_with_port_and_no_proto(self):
 
693
        with self.firewall_rule() as fwr:
 
694
            data = {'firewall_rule': {'protocol': None,
 
695
                                      'destination_port': 80}}
 
696
            req = self.new_update_request('firewall_rules', data,
 
697
                                          fwr['firewall_rule']['id'])
 
698
            res = req.get_response(self.ext_api)
 
699
            self.assertEqual(400, res.status_int)
 
700
 
 
701
    def test_update_firewall_rule_without_ports_and_no_proto(self):
 
702
        with self.firewall_rule() as fwr:
 
703
            data = {'firewall_rule': {'protocol': None,
 
704
                                      'destination_port': None,
 
705
                                      'source_port': None}}
 
706
            req = self.new_update_request('firewall_rules', data,
 
707
                                          fwr['firewall_rule']['id'])
 
708
            res = req.get_response(self.ext_api)
 
709
            self.assertEqual(200, res.status_int)
 
710
 
 
711
    def test_update_firewall_rule_with_port(self):
 
712
        with self.firewall_rule(source_port=None,
 
713
                                destination_port=None,
 
714
                                protocol=None) as fwr:
 
715
            data = {'firewall_rule': {'destination_port': 80}}
 
716
            req = self.new_update_request('firewall_rules', data,
 
717
                                          fwr['firewall_rule']['id'])
 
718
            res = req.get_response(self.ext_api)
 
719
            self.assertEqual(400, res.status_int)
 
720
 
 
721
    def test_update_firewall_rule_with_port_and_protocol(self):
 
722
        with self.firewall_rule(source_port=None,
 
723
                                destination_port=None,
 
724
                                protocol=None) as fwr:
 
725
            data = {'firewall_rule': {'destination_port': 80,
 
726
                                      'protocol': 'tcp'}}
 
727
            req = self.new_update_request('firewall_rules', data,
 
728
                                          fwr['firewall_rule']['id'])
 
729
            res = req.get_response(self.ext_api)
 
730
            self.assertEqual(200, res.status_int)
 
731
 
678
732
    def test_update_firewall_rule_with_policy_associated(self):
679
733
        name = "new_firewall_rule1"
680
734
        attrs = self._get_test_firewall_rule_attrs(name)