Remove string support in install_instructions
This was marked deprecated in the 'U' cycle, finally remove it. Had to tweak the bundle test accordingly. TrivialFix Change-Id: I0c860d723cd5bbc63a96f06fefb27857948912ae
This commit is contained in:
parent
70f9dd926f
commit
1e1cd593a4
@ -17,15 +17,12 @@
|
|||||||
import functools
|
import functools
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import debtcollector
|
|
||||||
import eventlet
|
import eventlet
|
||||||
import netaddr
|
import netaddr
|
||||||
from neutron_lib import exceptions
|
from neutron_lib import exceptions
|
||||||
import os_ken.app.ofctl.api as ofctl_api
|
import os_ken.app.ofctl.api as ofctl_api
|
||||||
from os_ken.app.ofctl import exception as ofctl_exc
|
from os_ken.app.ofctl import exception as ofctl_exc
|
||||||
import os_ken.exception as os_ken_exc
|
import os_ken.exception as os_ken_exc
|
||||||
from os_ken.lib import ofctl_string
|
|
||||||
from os_ken.ofproto import ofproto_parser
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
@ -230,13 +227,6 @@ class OpenFlowSwitchMixin(object):
|
|||||||
match=None, active_bundle=None, **match_kwargs):
|
match=None, active_bundle=None, **match_kwargs):
|
||||||
(dp, ofp, ofpp) = self._get_dp()
|
(dp, ofp, ofpp) = self._get_dp()
|
||||||
match = self._match(ofp, ofpp, match, **match_kwargs)
|
match = self._match(ofp, ofpp, match, **match_kwargs)
|
||||||
if isinstance(instructions, str):
|
|
||||||
debtcollector.deprecate(
|
|
||||||
"Use of string instruction is deprecated", removal_version='U')
|
|
||||||
jsonlist = ofctl_string.ofp_instruction_from_str(
|
|
||||||
ofp, instructions)
|
|
||||||
instructions = ofproto_parser.ofp_instruction_from_jsondict(
|
|
||||||
dp, jsonlist)
|
|
||||||
msg = ofpp.OFPFlowMod(dp,
|
msg = ofpp.OFPFlowMod(dp,
|
||||||
table_id=table_id,
|
table_id=table_id,
|
||||||
cookie=self.default_cookie,
|
cookie=self.default_cookie,
|
||||||
|
@ -403,35 +403,31 @@ class OVSFlowTestCase(OVSAgentTestBase):
|
|||||||
self.assertEqual(" unchanged", trace["Final flow"])
|
self.assertEqual(" unchanged", trace["Final flow"])
|
||||||
self.assertIn("drop", trace["Datapath actions"])
|
self.assertIn("drop", trace["Datapath actions"])
|
||||||
|
|
||||||
def test_install_instructions_str(self):
|
|
||||||
kwargs = {'in_port': 345, 'vlan_tci': 0x1123}
|
|
||||||
dst_p = self.useFixture(
|
|
||||||
net_helpers.OVSPortFixture(self.br_tun, self.namespace)).port
|
|
||||||
dst_ofp = self.br_tun.get_port_ofport(dst_p.name)
|
|
||||||
self.br_tun.install_instructions("pop_vlan,output:%d" % dst_ofp,
|
|
||||||
priority=10, **kwargs)
|
|
||||||
trace = self._run_trace(self.br_tun.br_name,
|
|
||||||
"in_port=%(in_port)d,dl_src=12:34:56:78:aa:bb,"
|
|
||||||
"dl_dst=24:12:56:78:aa:bb,dl_type=0x0800,"
|
|
||||||
"nw_src=192.168.0.1,nw_dst=192.168.0.2,"
|
|
||||||
"nw_proto=1,nw_tos=0,nw_ttl=128,"
|
|
||||||
"icmp_type=8,icmp_code=0,vlan_tci=%(vlan_tci)d"
|
|
||||||
% kwargs)
|
|
||||||
self.assertIn("pop_vlan,", trace["Datapath actions"])
|
|
||||||
|
|
||||||
def test_bundled_install(self):
|
def test_bundled_install(self):
|
||||||
kwargs = {'in_port': 345, 'vlan_tci': 0x1321}
|
kwargs = {'in_port': 345}
|
||||||
dst_p = self.useFixture(
|
with self.br_int.bundled() as br:
|
||||||
net_helpers.OVSPortFixture(self.br_tun, self.namespace)).port
|
br.install_goto(dest_table_id=ovs_constants.LOCAL_IP_TABLE)
|
||||||
dst_ofp = self.br_tun.get_port_ofport(dst_p.name)
|
br.install_goto(dest_table_id=ovs_constants.TRANSIENT_TABLE,
|
||||||
with self.br_tun.bundled() as br:
|
table_id=ovs_constants.LOCAL_IP_TABLE,
|
||||||
br.install_instructions("pop_vlan,output:%d" % dst_ofp,
|
priority=100)
|
||||||
priority=10, **kwargs)
|
br.install_drop(table_id=ovs_constants.TRANSIENT_TABLE,
|
||||||
trace = self._run_trace(self.br_tun.br_name,
|
priority=101, **kwargs)
|
||||||
|
br.install_normal(table_id=ovs_constants.TRANSIENT_TABLE,
|
||||||
|
priority=10)
|
||||||
|
|
||||||
|
trace = self._run_trace(self.br_int.br_name,
|
||||||
"in_port=%(in_port)d,dl_src=12:34:56:78:aa:bb,"
|
"in_port=%(in_port)d,dl_src=12:34:56:78:aa:bb,"
|
||||||
"dl_dst=24:12:56:78:aa:bb,dl_type=0x0800,"
|
"dl_dst=24:12:56:78:aa:bb,dl_type=0x0800,"
|
||||||
"nw_src=192.168.0.1,nw_dst=192.168.0.2,"
|
"nw_src=192.168.0.1,nw_dst=192.168.0.2,"
|
||||||
"nw_proto=1,nw_tos=0,nw_ttl=128,"
|
"nw_proto=1,nw_tos=0,nw_ttl=128,"
|
||||||
"icmp_type=8,icmp_code=0,vlan_tci=%(vlan_tci)d"
|
"icmp_type=8,icmp_code=0"
|
||||||
% kwargs)
|
% kwargs)
|
||||||
self.assertIn("pop_vlan,", trace["Datapath actions"])
|
self.assertIn("drop", trace["Datapath actions"])
|
||||||
|
|
||||||
|
trace = self._run_trace(self.br_int.br_name,
|
||||||
|
"dl_src=12:34:56:78:aa:bb,"
|
||||||
|
"dl_dst=24:12:56:78:aa:bb,dl_type=0x0800,"
|
||||||
|
"nw_src=192.168.0.1,nw_dst=192.168.0.2,"
|
||||||
|
"nw_proto=1,nw_tos=0,nw_ttl=128,"
|
||||||
|
"icmp_type=8,icmp_code=0")
|
||||||
|
self.assertNotIn("drop", trace["Datapath actions"])
|
||||||
|
Loading…
Reference in New Issue
Block a user