def test_update_packetfilter_with_all_params(self):
     resource = 'packet_filter'
     cmd = pf.UpdatePacketFilter(test_cli20.MyApp(sys.stdout), None)
     name = 'packetfilter1'
     args = ['--name', name,
             '--admin-state', 'True',
             '--src-mac', '00:11:22:33:44:55',
             '--dst-mac', 'aa:bb:cc:dd:ee:ff',
             '--eth-type', '0x0800',
             '--protocol', 'tcp',
             '--src-cidr', '10.1.1.0/24',
             '--dst-cidr', '10.2.2.0/24',
             '--src-port', '40001',
             '--dst-port', '4000',
             '--priority', '30000',
             '--action', 'drop',
             'myid'
             ]
     params = {'action': 'drop',
               'priority': '30000',
               'name': name,
               'admin_state_up': True,
               'src_mac': '00:11:22:33:44:55',
               'dst_mac': 'aa:bb:cc:dd:ee:ff',
               'eth_type': '0x0800',
               'protocol': 'tcp',
               'src_cidr': '10.1.1.0/24',
               'dst_cidr': '10.2.2.0/24',
               'src_port': '40001',
               'dst_port': '4000',
               }
     # position_names = sorted(params)
     # position_values = [params[k] for k in sorted(params)]
     self._test_update_resource(resource, cmd, 'myid',
                                args, params)
 def test_update_packetfilter_admin_state_false(self):
     resource = 'packet_filter'
     cmd = pf.UpdatePacketFilter(test_cli20.MyApp(sys.stdout), None)
     args = ['--admin-state', 'False', 'myid']
     params = {'admin_state_up': False}
     self._test_update_resource(resource, cmd, 'myid',
                                args, params)
 def test_update_packetfilter(self):
     """Update packetfilter: myid --name myname --tags a b."""
     resource = 'packet_filter'
     cmd = pf.UpdatePacketFilter(test_cli20.MyApp(sys.stdout), None)
     self._test_update_resource(resource, cmd, 'myid',
                                ['myid', '--name', 'myname'],
                                {'name': 'myname'})
 def test_update_packetfilter_exception(self):
     """Update packetfilter: myid."""
     resource = 'packet_filter'
     cmd = pf.UpdatePacketFilter(test_cli20.MyApp(sys.stdout), None)
     exc = self.assertRaises(exceptions.CommandError,
                             self._test_update_resource,
                             resource, cmd, 'myid', ['myid'], {})
     self.assertEqual('Must specify new values to update packet_filter',
                      unicode(exc))