Update cirros image version
The current cirros image version is 0.4.0. As we have the image name hard-coded, it is required that we update it manually. See [1] for reference. [1] https://review.openstack.org/#/c/521825/ Change-Id: I99a49975c5674991d84932ebd2c7ab6599d343ea Migrate Dragonflow from Ryu to os-ken This change causes Dragonflow to stop consuming Ryu in favor of os-ken. os-ken becomes the reference implementation for BGP services and Dragonflow no longer has a dependency on Ryu. See [1] for reference in Neutron. [1] https://review.openstack.org/607008/ Change-Id: Ifbf294f2f586cf765d20cfa60774c45aa735ca62 Force delete of VM on close There are tests that fail because we are waiting for the VM to complete shutdown In tests, we do not mind destroying the machine forcefully as there is no reason to wait for it. Change-Id: I5f8e4928ceb7b467af891835600cd8096ec88d2b use payloads for SECURITY_GROUP BEFORE_DELETE events This patch switches over to the payload style callbacks for BEFORE_DELETE events of SECURITY_GROUP resources. Co-Authored-By: Boden R <bodenvmw@gmail.com> Depends-On: https://review.openstack.org/#/c/597599/ Change-Id: Ie9163ad7baecf85e234e4253160f30015b43166b
This commit is contained in:
parent
18710ca010
commit
f1788f3ac6
|
@ -470,14 +470,14 @@ function disable_libvirt_apparmor {
|
||||||
sudo aa-complain /etc/apparmor.d/usr.sbin.libvirtd
|
sudo aa-complain /etc/apparmor.d/usr.sbin.libvirtd
|
||||||
}
|
}
|
||||||
|
|
||||||
function verify_ryu_version {
|
function verify_os_ken_version {
|
||||||
# Verify ryu is installed. Version greater than 3.29. Does not return
|
# Verify os_ken is installed. Version greater than 0.3.0. Does not return
|
||||||
# on failure.
|
# on failure.
|
||||||
RYU_VER_LINE=`ryu --version 2>&1 | head -n 1`
|
OS_KEN_VER_LINE=`osken --version 2>&1 | head -n 1`
|
||||||
RYU_VER=`echo $RYU_VER_LINE | cut -d' ' -f2`
|
OS_KEN_VER=`echo $OS_KEN_VER_LINE | cut -d' ' -f2`
|
||||||
echo "Found ryu version $RYU_VER ($RYU_VER_LINE)"
|
echo "Found os_ken version $OS_KEN_VER ($OS_KEN_VER_LINE)"
|
||||||
if [ `vercmp_numbers "$RYU_VER" "3.29.1"` -lt 0 ]; then
|
if [ `vercmp_numbers "$OS_KEN_VER" "0.3.0"` -lt 0 ]; then
|
||||||
die $LINENO "ryu version $RYU_VER too low. Version 3.29.1+ is required for Dragonflow."
|
die $LINENO "os_ken version $OS_KEN_VER too low. Version 0.3.0+ is required for Dragonflow."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,20 +184,20 @@ resources:
|
||||||
write_files:
|
write_files:
|
||||||
- content: |
|
- content: |
|
||||||
import os
|
import os
|
||||||
from ryu.base import app_manager
|
from os_ken.base import app_manager
|
||||||
from ryu.controller import ofp_event
|
from os_ken.controller import ofp_event
|
||||||
from ryu.controller.handler import CONFIG_DISPATCHER
|
from os_ken.controller.handler import CONFIG_DISPATCHER
|
||||||
from ryu.controller.handler import MAIN_DISPATCHER
|
from os_ken.controller.handler import MAIN_DISPATCHER
|
||||||
from ryu.controller.handler import set_ev_cls
|
from os_ken.controller.handler import set_ev_cls
|
||||||
from ryu.lib.packet import packet
|
from os_ken.lib.packet import packet
|
||||||
from ryu.lib.packet import ethernet
|
from os_ken.lib.packet import ethernet
|
||||||
from ryu.lib.packet import ipv4
|
from os_ken.lib.packet import ipv4
|
||||||
from ryu.lib.packet import mpls
|
from os_ken.lib.packet import mpls
|
||||||
from ryu.lib.packet import udp
|
from os_ken.lib.packet import udp
|
||||||
from ryu.ofproto import ofproto_v1_3
|
from os_ken.ofproto import ofproto_v1_3
|
||||||
FILTER = os.environ.get('SF_FILTER')
|
FILTER = os.environ.get('SF_FILTER')
|
||||||
SUB = os.environ.get('SF_SUB')
|
SUB = os.environ.get('SF_SUB')
|
||||||
class SimpleServiceFunction(app_manager.RyuApp):
|
class SimpleServiceFunction(app_manager.OsKenApp):
|
||||||
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
|
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
|
||||||
@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
|
@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
|
||||||
def switch_features_handler(self, ev):
|
def switch_features_handler(self, ev):
|
||||||
|
|
|
@ -173,7 +173,7 @@ remote BGP router will be updated by this service. When BGP speaker is updated,
|
||||||
this service will advertise/withdraw routes to/from remote BGP peer router
|
this service will advertise/withdraw routes to/from remote BGP peer router
|
||||||
|
|
||||||
The service will use the BGP drivers at [#]_. Currently, the only
|
The service will use the BGP drivers at [#]_. Currently, the only
|
||||||
implementation is based on *ryu.services.protocols.bgp*. But when other
|
implementation is based on *os_ken.services.protocols.bgp*. But when other
|
||||||
drivers are added, it is easy to switch to other implementations.
|
drivers are added, it is easy to switch to other implementations.
|
||||||
|
|
||||||
.. [#] https://github.com/openstack/neutron-dynamic-routing/tree/master/neutron_dynamic_routing/services/bgp/agent/driver
|
.. [#] https://github.com/openstack/neutron-dynamic-routing/tree/master/neutron_dynamic_routing/services/bgp/agent/driver
|
||||||
|
|
|
@ -22,9 +22,9 @@ from dragonflow.conf import df_l2
|
||||||
from dragonflow.conf import df_l3
|
from dragonflow.conf import df_l3
|
||||||
from dragonflow.conf import df_loadbalancer
|
from dragonflow.conf import df_loadbalancer
|
||||||
from dragonflow.conf import df_metadata_service
|
from dragonflow.conf import df_metadata_service
|
||||||
|
from dragonflow.conf import df_os_ken
|
||||||
from dragonflow.conf import df_provider_networks
|
from dragonflow.conf import df_provider_networks
|
||||||
from dragonflow.conf import df_redis
|
from dragonflow.conf import df_redis
|
||||||
from dragonflow.conf import df_ryu
|
|
||||||
from dragonflow.conf import df_skydive
|
from dragonflow.conf import df_skydive
|
||||||
from dragonflow.conf import df_snat
|
from dragonflow.conf import df_snat
|
||||||
from dragonflow.conf import df_zmq
|
from dragonflow.conf import df_zmq
|
||||||
|
@ -44,7 +44,7 @@ df_l3.register_opts()
|
||||||
df_dnat.register_opts()
|
df_dnat.register_opts()
|
||||||
df_redis.register_opts()
|
df_redis.register_opts()
|
||||||
df_zmq.register_opts()
|
df_zmq.register_opts()
|
||||||
df_ryu.register_opts()
|
df_os_ken.register_opts()
|
||||||
df_provider_networks.register_opts()
|
df_provider_networks.register_opts()
|
||||||
df_snat.register_opts()
|
df_snat.register_opts()
|
||||||
df_bgp.register_opts()
|
df_bgp.register_opts()
|
||||||
|
|
|
@ -23,7 +23,7 @@ df_bgp_app_opts = [
|
||||||
'and advertise BGP routes')),
|
'and advertise BGP routes')),
|
||||||
cfg.StrOpt('bgp_speaker_driver',
|
cfg.StrOpt('bgp_speaker_driver',
|
||||||
default='neutron_dynamic_routing.services.bgp.agent.driver.'
|
default='neutron_dynamic_routing.services.bgp.agent.driver.'
|
||||||
'ryu.driver.RyuBgpDriver',
|
'os_ken.driver.OsKenBgpDriver',
|
||||||
help=_("BGP speaker driver class to be instantiated.")),
|
help=_("BGP speaker driver class to be instantiated.")),
|
||||||
cfg.StrOpt('bgp_router_id',
|
cfg.StrOpt('bgp_router_id',
|
||||||
default='127.0.0.1',
|
default='127.0.0.1',
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from os_ken.ofproto import ofproto_common
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from ryu.ofproto import ofproto_common
|
|
||||||
|
|
||||||
from dragonflow._i18n import _
|
from dragonflow._i18n import _
|
||||||
|
|
||||||
df_ryu_opts = [
|
df_os_ken_opts = [
|
||||||
cfg.IPOpt('of_listen_address', default='127.0.0.1',
|
cfg.IPOpt('of_listen_address', default='127.0.0.1',
|
||||||
help=_("Address to listen on for OpenFlow connections.")),
|
help=_("Address to listen on for OpenFlow connections.")),
|
||||||
cfg.PortOpt('of_listen_port', default=ofproto_common.OFP_TCP_PORT,
|
cfg.PortOpt('of_listen_port', default=ofproto_common.OFP_TCP_PORT,
|
||||||
|
@ -27,8 +27,8 @@ df_ryu_opts = [
|
||||||
|
|
||||||
|
|
||||||
def register_opts():
|
def register_opts():
|
||||||
cfg.CONF.register_opts(df_ryu_opts, 'df_ryu')
|
cfg.CONF.register_opts(df_os_ken_opts, 'df_os_ken')
|
||||||
|
|
||||||
|
|
||||||
def list_opts():
|
def list_opts():
|
||||||
return {'df_ryu': df_ryu_opts}
|
return {'df_os_ken': df_os_ken_opts}
|
|
@ -16,11 +16,11 @@
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.lib.packet import arp
|
||||||
|
from os_ken.lib.packet import packet
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_service import loopingcall
|
from oslo_service import loopingcall
|
||||||
from ryu.lib.packet import arp
|
|
||||||
from ryu.lib.packet import packet
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
from dragonflow.controller.common import constants as controller_const
|
from dragonflow.controller.common import constants as controller_const
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow._i18n import _
|
from dragonflow._i18n import _
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from os_ken.ofproto import nicira_ext
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.ofproto import nicira_ext
|
|
||||||
|
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
from dragonflow.controller import df_base_app
|
from dragonflow.controller import df_base_app
|
||||||
|
|
|
@ -21,14 +21,14 @@ import struct
|
||||||
|
|
||||||
from neutron.conf import common as common_config
|
from neutron.conf import common as common_config
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.lib import addrconv
|
||||||
|
from os_ken.lib.packet import dhcp
|
||||||
|
from os_ken.lib.packet import ethernet
|
||||||
|
from os_ken.lib.packet import ipv4
|
||||||
|
from os_ken.lib.packet import packet as os_ken_packet
|
||||||
|
from os_ken.lib.packet import udp
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib import addrconv
|
|
||||||
from ryu.lib.packet import dhcp
|
|
||||||
from ryu.lib.packet import ethernet
|
|
||||||
from ryu.lib.packet import ipv4
|
|
||||||
from ryu.lib.packet import packet as ryu_packet
|
|
||||||
from ryu.lib.packet import udp
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.common import utils as df_utils
|
from dragonflow.common import utils as df_utils
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
|
@ -95,7 +95,7 @@ class DHCPApp(df_base_app.DFlowApp):
|
||||||
def packet_in_handler(self, event):
|
def packet_in_handler(self, event):
|
||||||
msg = event.msg
|
msg = event.msg
|
||||||
|
|
||||||
pkt = ryu_packet.Packet(msg.data)
|
pkt = os_ken_packet.Packet(msg.data)
|
||||||
pkt_ip = pkt.get_protocol(ipv4.ipv4)
|
pkt_ip = pkt.get_protocol(ipv4.ipv4)
|
||||||
|
|
||||||
if not pkt_ip:
|
if not pkt_ip:
|
||||||
|
@ -187,7 +187,7 @@ class DHCPApp(df_base_app.DFlowApp):
|
||||||
|
|
||||||
options = dhcp.options(option_list=option_list)
|
options = dhcp.options(option_list=option_list)
|
||||||
|
|
||||||
dhcp_response = ryu_packet.Packet()
|
dhcp_response = os_ken_packet.Packet()
|
||||||
dhcp_response.add_protocol(ethernet.ethernet(
|
dhcp_response.add_protocol(ethernet.ethernet(
|
||||||
ethertype=ether.ETH_TYPE_IP,
|
ethertype=ether.ETH_TYPE_IP,
|
||||||
dst=pkt_ethernet.src,
|
dst=pkt_ethernet.src,
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.lib.packet import ethernet
|
||||||
|
from os_ken.lib.packet import icmp
|
||||||
|
from os_ken.lib.packet import in_proto
|
||||||
|
from os_ken.lib.packet import ipv4
|
||||||
|
from os_ken.lib.packet import packet
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib.packet import ethernet
|
|
||||||
from ryu.lib.packet import icmp
|
|
||||||
from ryu.lib.packet import in_proto
|
|
||||||
from ryu.lib.packet import ipv4
|
|
||||||
from ryu.lib.packet import packet
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.common import utils as df_utils
|
from dragonflow.common import utils as df_utils
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from neutron_lib import constants as lib_constants
|
from neutron_lib import constants as lib_constants
|
||||||
|
from os_ken.lib.packet import ether_types
|
||||||
|
from os_ken.lib.packet import in_proto
|
||||||
|
from os_ken.ofproto import nicira_ext
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib.packet import ether_types
|
|
||||||
from ryu.lib.packet import in_proto
|
|
||||||
from ryu.ofproto import nicira_ext
|
|
||||||
|
|
||||||
from dragonflow._i18n import _
|
from dragonflow._i18n import _
|
||||||
from dragonflow.controller.common import constants
|
from dragonflow.controller.common import constants
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from neutron_lib import constants as common_const
|
from neutron_lib import constants as common_const
|
||||||
|
from os_ken.lib.mac import haddr_to_bin
|
||||||
|
from os_ken.lib.packet import in_proto
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib.mac import haddr_to_bin
|
|
||||||
from ryu.lib.packet import in_proto
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
from dragonflow.controller.common import arp_responder
|
from dragonflow.controller.common import arp_responder
|
||||||
|
|
|
@ -17,14 +17,14 @@ import copy
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from neutron_lib import constants as common_const
|
from neutron_lib import constants as common_const
|
||||||
|
from os_ken.lib import mac as os_ken_mac_lib
|
||||||
|
from os_ken.lib.packet import ethernet
|
||||||
|
from os_ken.lib.packet import icmp
|
||||||
|
from os_ken.lib.packet import packet
|
||||||
|
from os_ken.lib.packet import tcp
|
||||||
|
from os_ken.lib.packet import udp
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib import mac as ryu_mac_lib
|
|
||||||
from ryu.lib.packet import ethernet
|
|
||||||
from ryu.lib.packet import icmp
|
|
||||||
from ryu.lib.packet import packet
|
|
||||||
from ryu.lib.packet import tcp
|
|
||||||
from ryu.lib.packet import udp
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.common import exceptions
|
from dragonflow.common import exceptions
|
||||||
from dragonflow.common import utils as df_utils
|
from dragonflow.common import utils as df_utils
|
||||||
|
@ -72,7 +72,7 @@ class L3AppMixin(object):
|
||||||
Create an ICMP error packet, and return it.
|
Create an ICMP error packet, and return it.
|
||||||
|
|
||||||
:param msg: Packet in message
|
:param msg: Packet in message
|
||||||
:type msg: ryu.ofproto.ofproto_v<version>_parser.OFPPacketIn
|
:type msg: os_ken.ofproto.ofproto_v<version>_parser.OFPPacketIn
|
||||||
"""
|
"""
|
||||||
if self.ttl_invalid_handler_rate_limit():
|
if self.ttl_invalid_handler_rate_limit():
|
||||||
LOG.warning("Get more than %(rate)s TTL invalid packets per "
|
LOG.warning("Get more than %(rate)s TTL invalid packets per "
|
||||||
|
@ -114,7 +114,7 @@ class L3AppMixin(object):
|
||||||
Destination Unreachable message.
|
Destination Unreachable message.
|
||||||
|
|
||||||
:param msg: Packet in message
|
:param msg: Packet in message
|
||||||
:type msg: ryu.ofproto.ofproto_v<version>_parser.OFPPacketIn
|
:type msg: os_ken.ofproto.ofproto_v<version>_parser.OFPPacketIn
|
||||||
"""
|
"""
|
||||||
# If the destination is router interface, the unique key of router
|
# If the destination is router interface, the unique key of router
|
||||||
# interface will be set to reg7 before sending to local controller.
|
# interface will be set to reg7 before sending to local controller.
|
||||||
|
@ -147,7 +147,7 @@ class L3AppMixin(object):
|
||||||
handle.
|
handle.
|
||||||
|
|
||||||
:param msg: Packet in message
|
:param msg: Packet in message
|
||||||
:type msg: ryu.ofproto.ofproto_v<version>_parser.OFPPacketIn
|
:type msg: os_ken.ofproto.ofproto_v<version>_parser.OFPPacketIn
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if msg.reason == self.ofproto.OFPR_INVALID_TTL:
|
if msg.reason == self.ofproto.OFPR_INVALID_TTL:
|
||||||
|
@ -518,7 +518,7 @@ class L3AppMixin(object):
|
||||||
# to L3_LOOKUP_TABLE
|
# to L3_LOOKUP_TABLE
|
||||||
match = parser.OFPMatch()
|
match = parser.OFPMatch()
|
||||||
match.set_metadata(local_network_id)
|
match.set_metadata(local_network_id)
|
||||||
match.set_dl_dst(ryu_mac_lib.haddr_to_bin(mac))
|
match.set_dl_dst(os_ken_mac_lib.haddr_to_bin(mac))
|
||||||
actions = [parser.OFPActionSetField(reg5=router_unique_key)]
|
actions = [parser.OFPActionSetField(reg5=router_unique_key)]
|
||||||
action_inst = parser.OFPInstructionActions(
|
action_inst = parser.OFPInstructionActions(
|
||||||
ofproto.OFPIT_APPLY_ACTIONS, actions)
|
ofproto.OFPIT_APPLY_ACTIONS, actions)
|
||||||
|
@ -586,7 +586,7 @@ class L3AppMixin(object):
|
||||||
# to L3_LOOKUP_TABLE
|
# to L3_LOOKUP_TABLE
|
||||||
match = parser.OFPMatch()
|
match = parser.OFPMatch()
|
||||||
match.set_metadata(local_network_id)
|
match.set_metadata(local_network_id)
|
||||||
match.set_dl_dst(ryu_mac_lib.haddr_to_bin(mac))
|
match.set_dl_dst(os_ken_mac_lib.haddr_to_bin(mac))
|
||||||
self.mod_flow(
|
self.mod_flow(
|
||||||
table_id=const.L2_LOOKUP_TABLE,
|
table_id=const.L2_LOOKUP_TABLE,
|
||||||
command=ofproto.OFPFC_DELETE,
|
command=ofproto.OFPFC_DELETE,
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.controller.apps import l3_base
|
from dragonflow.controller.apps import l3_base
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.lib.packet import ipv4
|
||||||
|
from os_ken.lib.packet import ipv6
|
||||||
|
from os_ken.lib.packet import packet
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib.packet import ipv4
|
|
||||||
from ryu.lib.packet import ipv6
|
|
||||||
from ryu.lib.packet import packet
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.controller.apps import l3_base
|
from dragonflow.controller.apps import l3_base
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
|
@ -73,12 +73,12 @@ class L3ReactiveApp(df_base_app.DFlowApp, l3_base.L3AppMixin):
|
||||||
Install the routing flows by the information in the packet, and
|
Install the routing flows by the information in the packet, and
|
||||||
have the packet continue along the pipelone.
|
have the packet continue along the pipelone.
|
||||||
|
|
||||||
:param pkt_ip: IP header on the packet (IPv4 or IPv6)
|
:param pkt_ip: IP header on the packet (IPv4 or IPv6)
|
||||||
:type pkt_ip: ryu.packet.ipv4 or ryu.packet.ipv6
|
:type pkt_ip: os_ken.packet.ipv4 or os_ken.packet.ipv6
|
||||||
:param network_id: The source network from which the packet arrived
|
:param network_id: The source network from which the packet arrived
|
||||||
:type network_id: Integer
|
:type network_id: Integer
|
||||||
:param msg: Packet in message
|
:param msg: Packet in message
|
||||||
:type msg: ryu.ofproto.ofproto_v<version>_parser.OFPPacketIn
|
:type msg: os_ken.ofproto.ofproto_v<version>_parser.OFPPacketIn
|
||||||
"""
|
"""
|
||||||
ip_addr = netaddr.IPAddress(pkt_ip.dst)
|
ip_addr = netaddr.IPAddress(pkt_ip.dst)
|
||||||
router_unique_key = msg.match.get('reg5')
|
router_unique_key = msg.match.get('reg5')
|
||||||
|
@ -110,7 +110,7 @@ class L3ReactiveApp(df_base_app.DFlowApp, l3_base.L3AppMixin):
|
||||||
:param dst_port: Destination port
|
:param dst_port: Destination port
|
||||||
:type dst_port: LogicalPort
|
:type dst_port: LogicalPort
|
||||||
:param msg: Packet in message
|
:param msg: Packet in message
|
||||||
:type msg: ryu.ofproto.ofproto_v<version>_parser.\
|
:type msg: os_ken.ofproto.ofproto_v<version>_parser.\
|
||||||
OFPPacketIn
|
OFPPacketIn
|
||||||
:param src_network_id: The source network of the packet
|
:param src_network_id: The source network of the packet
|
||||||
:type src_network_id: Integer
|
:type src_network_id: Integer
|
||||||
|
|
|
@ -18,12 +18,12 @@ import hmac
|
||||||
|
|
||||||
import httplib2
|
import httplib2
|
||||||
import netaddr
|
import netaddr
|
||||||
|
from os_ken.lib.packet import arp
|
||||||
|
from os_ken.lib.packet import ethernet
|
||||||
|
from os_ken.lib.packet import ipv4
|
||||||
|
from os_ken.ofproto import nicira_ext
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
from ryu.lib.packet import arp
|
|
||||||
from ryu.lib.packet import ethernet
|
|
||||||
from ryu.lib.packet import ipv4
|
|
||||||
from ryu.ofproto import nicira_ext
|
|
||||||
import six
|
import six
|
||||||
import six.moves.urllib.parse as urlparse
|
import six.moves.urllib.parse as urlparse
|
||||||
import webob
|
import webob
|
||||||
|
@ -43,9 +43,9 @@ LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
FLOW_IDLE_TIMEOUT = 60
|
FLOW_IDLE_TIMEOUT = 60
|
||||||
|
|
||||||
# TODO(oanson) The TCP_* flag constants have already made it into ryu
|
# TODO(oanson) The TCP_* flag constants have already made it into os_ken
|
||||||
# master, but not to pip. Once that is done, they should be taken from
|
# master, but not to pip. Once that is done, they should be taken from
|
||||||
# there. (ryu.lib.packet.tcp.TCP_SYN and ryu.lib.packet.tcp.TCP_ACK)
|
# there. (os_ken.lib.packet.tcp.TCP_SYN and os_ken.lib.packet.tcp.TCP_ACK)
|
||||||
TCP_SYN = 0x002
|
TCP_SYN = 0x002
|
||||||
TCP_ACK = 0x010
|
TCP_ACK = 0x010
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.lib.packet import arp
|
||||||
|
from os_ken.lib.packet import in_proto
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib.packet import arp
|
|
||||||
from ryu.lib.packet import in_proto
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.controller import app_base
|
from dragonflow.controller import app_base
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron_lib.utils import helpers
|
from neutron_lib.utils import helpers
|
||||||
|
from os_ken.lib import mac as mac_api
|
||||||
|
from os_ken.ofproto import nicira_ext
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib import mac as mac_api
|
|
||||||
from ryu.ofproto import nicira_ext
|
|
||||||
|
|
||||||
from dragonflow.common import utils
|
from dragonflow.common import utils
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from os_ken.lib.packet import ether_types
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib.packet import ether_types
|
|
||||||
|
|
||||||
from dragonflow.controller.apps import sfc_driver_base
|
from dragonflow.controller.apps import sfc_driver_base
|
||||||
from dragonflow.controller.common import constants
|
from dragonflow.controller.common import constants
|
||||||
|
|
|
@ -18,8 +18,8 @@ import copy
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
from dragonflow.controller.common import utils
|
from dragonflow.controller.common import utils
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.ofproto import ether
|
||||||
|
from os_ken.ofproto import nicira_ext
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.ofproto import ether
|
|
||||||
from ryu.ofproto import nicira_ext
|
|
||||||
|
|
||||||
from dragonflow.common import constants as df_common_const
|
from dragonflow.common import constants as df_common_const
|
||||||
from dragonflow.common import utils as df_utils
|
from dragonflow.common import utils as df_utils
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.common import exceptions
|
from dragonflow.common import exceptions
|
||||||
from dragonflow.controller.common import constants
|
from dragonflow.controller.common import constants
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from os_ken.lib import mac as mac_api
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib import mac as mac_api
|
|
||||||
|
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ryu.lib.packet import arp
|
from os_ken.lib.packet import arp
|
||||||
from ryu.ofproto import ether
|
from os_ken.ofproto import ether
|
||||||
|
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
from dragonflow.controller.common import utils
|
from dragonflow.controller.common import utils
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ryu.lib.packet import ethernet
|
from os_ken.lib.packet import ethernet
|
||||||
from ryu.lib.packet import icmp
|
from os_ken.lib.packet import icmp
|
||||||
from ryu.lib.packet import ipv4
|
from os_ken.lib.packet import ipv4
|
||||||
from ryu.lib.packet import packet
|
from os_ken.lib.packet import packet
|
||||||
from ryu.ofproto import inet
|
from os_ken.ofproto import inet
|
||||||
|
|
||||||
|
|
||||||
def generate(icmp_type, icmp_code, msg_data, src_ip=None, pkt=None):
|
def generate(icmp_type, icmp_code, msg_data, src_ip=None, pkt=None):
|
||||||
|
@ -28,7 +28,8 @@ def generate(icmp_type, icmp_code, msg_data, src_ip=None, pkt=None):
|
||||||
:param msg_data: The original data that cause this ICMP error packet
|
:param msg_data: The original data that cause this ICMP error packet
|
||||||
:param src_ip: The source ip of the packet
|
:param src_ip: The source ip of the packet
|
||||||
:param pkt: The original packet that cause this ICMP error
|
:param pkt: The original packet that cause this ICMP error
|
||||||
:returns: An ryu.lib.packet.packet.Packet instance, which is an ICMP packet
|
:returns: An os_ken.lib.packet.packet.Packet instance,
|
||||||
|
which is an ICMP packet
|
||||||
"""
|
"""
|
||||||
if not pkt:
|
if not pkt:
|
||||||
pkt = packet.Packet(msg_data)
|
pkt = packet.Packet(msg_data)
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ryu.lib.packet import icmp
|
from os_ken.lib.packet import icmp
|
||||||
from ryu.lib.packet import in_proto
|
from os_ken.lib.packet import in_proto
|
||||||
from ryu.ofproto import ether
|
from os_ken.ofproto import ether
|
||||||
|
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ryu.lib.packet import icmpv6
|
from os_ken.lib.packet import icmpv6
|
||||||
from ryu.lib.packet import in_proto
|
from os_ken.lib.packet import in_proto
|
||||||
from ryu.ofproto import ether
|
from os_ken.ofproto import ether
|
||||||
|
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
from dragonflow.controller.common import utils
|
from dragonflow.controller.common import utils
|
||||||
|
|
|
@ -16,9 +16,9 @@ import struct
|
||||||
import netaddr
|
import netaddr
|
||||||
from neutron.agent.common import utils
|
from neutron.agent.common import utils
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.lib import addrconv
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib import addrconv
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.common import exceptions
|
from dragonflow.common import exceptions
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
|
from os_ken.app.ofctl import api as ofctl_api
|
||||||
|
from os_ken.lib.packet import arp
|
||||||
|
from os_ken.lib.packet import ethernet
|
||||||
|
from os_ken.lib.packet import packet
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.app.ofctl import api as ofctl_api
|
|
||||||
from ryu.lib.packet import arp
|
|
||||||
from ryu.lib.packet import ethernet
|
|
||||||
from ryu.lib.packet import packet
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow._i18n import _
|
from dragonflow._i18n import _
|
||||||
from dragonflow.controller.common import constants
|
from dragonflow.controller.common import constants
|
||||||
|
|
|
@ -110,7 +110,10 @@ def _get_lock_id_by_resource_type(resource_type, *args, **kwargs):
|
||||||
elif RESOURCE_ROUTER_UPDATE_OR_DELETE == resource_type:
|
elif RESOURCE_ROUTER_UPDATE_OR_DELETE == resource_type:
|
||||||
lock_id = args[2]
|
lock_id = args[2]
|
||||||
elif RESOURCE_ML2_SECURITY_GROUP == resource_type:
|
elif RESOURCE_ML2_SECURITY_GROUP == resource_type:
|
||||||
lock_id = kwargs['security_group']['id']
|
try:
|
||||||
|
lock_id = kwargs['security_group']['id']
|
||||||
|
except KeyError:
|
||||||
|
lock_id = kwargs['payload'].latest_state['id']
|
||||||
elif RESOURCE_ML2_SECURITY_GROUP_RULE_CREATE == resource_type:
|
elif RESOURCE_ML2_SECURITY_GROUP_RULE_CREATE == resource_type:
|
||||||
lock_id = kwargs['security_group_rule']['security_group_id']
|
lock_id = kwargs['security_group_rule']['security_group_id']
|
||||||
elif RESOURCE_ML2_SECURITY_GROUP_RULE_DELETE == resource_type:
|
elif RESOURCE_ML2_SECURITY_GROUP_RULE_DELETE == resource_type:
|
||||||
|
|
|
@ -173,8 +173,8 @@ class DFMechDriver(api.MechanismDriver):
|
||||||
return sg_obj
|
return sg_obj
|
||||||
|
|
||||||
@lock_db.wrap_db_lock(lock_db.RESOURCE_ML2_SECURITY_GROUP)
|
@lock_db.wrap_db_lock(lock_db.RESOURCE_ML2_SECURITY_GROUP)
|
||||||
def delete_security_group(self, resource, event, trigger, **kwargs):
|
def delete_security_group(self, resource, event, trigger, payload=None):
|
||||||
sg = kwargs['security_group']
|
sg = payload.latest_state
|
||||||
topic = df_utils.get_obj_topic(sg)
|
topic = df_utils.get_obj_topic(sg)
|
||||||
sg_obj = secgroups.SecurityGroup(id=sg['id'], topic=topic)
|
sg_obj = secgroups.SecurityGroup(id=sg['id'], topic=topic)
|
||||||
self.nb_api.delete(sg_obj)
|
self.nb_api.delete(sg_obj)
|
||||||
|
|
|
@ -72,13 +72,13 @@ class Datapath(object):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_up(self, ryu_base, switch_backend, nb_api, neutron_notifier):
|
def set_up(self, os_ken_base, switch_backend, nb_api, neutron_notifier):
|
||||||
"""
|
"""
|
||||||
Instantiate the application classes.
|
Instantiate the application classes.
|
||||||
Instantiate the applications (Including table and register allocation)
|
Instantiate the applications (Including table and register allocation)
|
||||||
Wire the applications (including translating registers)
|
Wire the applications (including translating registers)
|
||||||
"""
|
"""
|
||||||
self._dp = ryu_base.datapath
|
self._dp = os_ken_base.datapath
|
||||||
self._table_generator = _sequence_generator(
|
self._table_generator = _sequence_generator(
|
||||||
cfg.CONF.df.datapath_autoalloc_table_offset)
|
cfg.CONF.df.datapath_autoalloc_table_offset)
|
||||||
self._public_variables.clear()
|
self._public_variables.clear()
|
||||||
|
@ -101,7 +101,7 @@ class Datapath(object):
|
||||||
dp_alloc = self._create_dp_alloc(app_class._specification)
|
dp_alloc = self._create_dp_alloc(app_class._specification)
|
||||||
self.log_datapath_allocation(vertex.name, dp_alloc)
|
self.log_datapath_allocation(vertex.name, dp_alloc)
|
||||||
self._dp_allocs[vertex.name] = dp_alloc
|
self._dp_allocs[vertex.name] = dp_alloc
|
||||||
app = app_class(api=ryu_base,
|
app = app_class(api=os_ken_base,
|
||||||
switch_backend=switch_backend,
|
switch_backend=switch_backend,
|
||||||
nb_api=nb_api,
|
nb_api=nb_api,
|
||||||
neutron_server_notifier=neutron_notifier,
|
neutron_server_notifier=neutron_notifier,
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ryu.app.ofctl import service as of_service
|
from os_ken.app.ofctl import service as of_service
|
||||||
from ryu.base import app_manager
|
from os_ken.base import app_manager
|
||||||
from ryu import cfg as ryu_cfg
|
from os_ken import cfg as os_ken_cfg
|
||||||
|
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
from dragonflow.controller import datapath_layout
|
from dragonflow.controller import datapath_layout
|
||||||
|
@ -24,13 +24,13 @@ from dragonflow.db.models import switch
|
||||||
from dragonflow.ovsdb import vswitch_impl
|
from dragonflow.ovsdb import vswitch_impl
|
||||||
from dragonflow.switch.drivers import df_switch_driver
|
from dragonflow.switch.drivers import df_switch_driver
|
||||||
from dragonflow.switch.drivers.ovs import datapath
|
from dragonflow.switch.drivers.ovs import datapath
|
||||||
from dragonflow.switch.drivers.ovs import ryu_base_app
|
from dragonflow.switch.drivers.ovs import os_ken_base_app
|
||||||
|
|
||||||
|
|
||||||
class DfOvsDriver(df_switch_driver.DfSwitchDriver):
|
class DfOvsDriver(df_switch_driver.DfSwitchDriver):
|
||||||
def __init__(self, nb_api, ip):
|
def __init__(self, nb_api, ip):
|
||||||
super(DfOvsDriver, self).__init__(nb_api)
|
super(DfOvsDriver, self).__init__(nb_api)
|
||||||
init_ryu_config()
|
init_os_ken_config()
|
||||||
self.vswitch_api = vswitch_impl.OvsApi(ip)
|
self.vswitch_api = vswitch_impl.OvsApi(ip)
|
||||||
self.app_mgr = app_manager.AppManager.get_instance()
|
self.app_mgr = app_manager.AppManager.get_instance()
|
||||||
self.open_flow_app = None
|
self.open_flow_app = None
|
||||||
|
@ -43,7 +43,7 @@ class DfOvsDriver(df_switch_driver.DfSwitchDriver):
|
||||||
super(DfOvsDriver, self).initialize(db_change_callback,
|
super(DfOvsDriver, self).initialize(db_change_callback,
|
||||||
neutron_notifier)
|
neutron_notifier)
|
||||||
self.open_flow_app = self.app_mgr.instantiate(
|
self.open_flow_app = self.app_mgr.instantiate(
|
||||||
ryu_base_app.RyuDFAdapter,
|
os_ken_base_app.OsKenDFAdapter,
|
||||||
nb_api=self.nb_api,
|
nb_api=self.nb_api,
|
||||||
switch_backend=self,
|
switch_backend=self,
|
||||||
neutron_server_notifier=self.neutron_notifier,
|
neutron_server_notifier=self.neutron_notifier,
|
||||||
|
@ -67,8 +67,8 @@ class DfOvsDriver(df_switch_driver.DfSwitchDriver):
|
||||||
# for reliability, here we should check if controller is set for OVS,
|
# for reliability, here we should check if controller is set for OVS,
|
||||||
# if yes, don't set controller and don't delete controller.
|
# if yes, don't set controller and don't delete controller.
|
||||||
# if no, set controller
|
# if no, set controller
|
||||||
targets = ('tcp:' + cfg.CONF.df_ryu.of_listen_address + ':' +
|
targets = ('tcp:' + cfg.CONF.df_os_ken.of_listen_address + ':' +
|
||||||
str(cfg.CONF.df_ryu.of_listen_port))
|
str(cfg.CONF.df_os_ken.of_listen_port))
|
||||||
is_controller_set = self.vswitch_api.check_controller(targets)
|
is_controller_set = self.vswitch_api.check_controller(targets)
|
||||||
integration_bridge = cfg.CONF.df.integration_bridge
|
integration_bridge = cfg.CONF.df.integration_bridge
|
||||||
if not is_controller_set:
|
if not is_controller_set:
|
||||||
|
@ -101,7 +101,7 @@ class DfOvsDriver(df_switch_driver.DfSwitchDriver):
|
||||||
'update', status)
|
'update', status)
|
||||||
|
|
||||||
|
|
||||||
def init_ryu_config():
|
def init_os_ken_config():
|
||||||
ryu_cfg.CONF(project='ryu', args=[])
|
os_ken_cfg.CONF(project='os_ken', args=[])
|
||||||
ryu_cfg.CONF.ofp_listen_host = cfg.CONF.df_ryu.of_listen_address
|
os_ken_cfg.CONF.ofp_listen_host = cfg.CONF.df_os_ken.of_listen_address
|
||||||
ryu_cfg.CONF.ofp_tcp_listen_port = cfg.CONF.df_ryu.of_listen_port
|
os_ken_cfg.CONF.ofp_tcp_listen_port = cfg.CONF.df_os_ken.of_listen_port
|
||||||
|
|
|
@ -15,15 +15,15 @@
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from os_ken.controller import handler
|
||||||
|
from os_ken.controller import ofp_event
|
||||||
|
from os_ken.controller import ofp_handler
|
||||||
|
from os_ken.ofproto import ofproto_common
|
||||||
|
from os_ken.ofproto import ofproto_parser
|
||||||
|
from os_ken.ofproto import ofproto_v1_3
|
||||||
|
from os_ken import utils
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.controller import handler
|
|
||||||
from ryu.controller import ofp_event
|
|
||||||
from ryu.controller import ofp_handler
|
|
||||||
from ryu.ofproto import ofproto_common
|
|
||||||
from ryu.ofproto import ofproto_parser
|
|
||||||
from ryu.ofproto import ofproto_v1_3
|
|
||||||
from ryu import utils
|
|
||||||
|
|
||||||
from dragonflow.common import profiler as df_profiler
|
from dragonflow.common import profiler as df_profiler
|
||||||
from dragonflow.controller.common import constants
|
from dragonflow.controller.common import constants
|
||||||
|
@ -33,14 +33,14 @@ from dragonflow.controller import dispatcher
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class RyuDFAdapter(ofp_handler.OFPHandler):
|
class OsKenDFAdapter(ofp_handler.OFPHandler):
|
||||||
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
|
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
|
||||||
OF_AUTO_PORT_DESC_STATS_REQ_VER = 0x04
|
OF_AUTO_PORT_DESC_STATS_REQ_VER = 0x04
|
||||||
|
|
||||||
def __init__(self, switch_backend, nb_api,
|
def __init__(self, switch_backend, nb_api,
|
||||||
db_change_callback,
|
db_change_callback,
|
||||||
neutron_server_notifier=None):
|
neutron_server_notifier=None):
|
||||||
super(RyuDFAdapter, self).__init__()
|
super(OsKenDFAdapter, self).__init__()
|
||||||
self.dispatcher = dispatcher.AppDispatcher(cfg.CONF.df.apps_list)
|
self.dispatcher = dispatcher.AppDispatcher(cfg.CONF.df.apps_list)
|
||||||
self.vswitch_api = switch_backend.vswitch_api
|
self.vswitch_api = switch_backend.vswitch_api
|
||||||
self.nb_api = nb_api
|
self.nb_api = nb_api
|
||||||
|
@ -56,7 +56,7 @@ class RyuDFAdapter(ofp_handler.OFPHandler):
|
||||||
return self._datapath
|
return self._datapath
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
super(RyuDFAdapter, self).start()
|
super(OsKenDFAdapter, self).start()
|
||||||
self.load(self,
|
self.load(self,
|
||||||
switch_backend=self.switch_backend,
|
switch_backend=self.switch_backend,
|
||||||
nb_api=self.nb_api,
|
nb_api=self.nb_api,
|
||||||
|
@ -101,9 +101,9 @@ class RyuDFAdapter(ofp_handler.OFPHandler):
|
||||||
def switch_features_handler(self, ev):
|
def switch_features_handler(self, ev):
|
||||||
# TODO(oanson) is there a better way to get the datapath?
|
# TODO(oanson) is there a better way to get the datapath?
|
||||||
self._datapath = ev.msg.datapath
|
self._datapath = ev.msg.datapath
|
||||||
super(RyuDFAdapter, self).switch_features_handler(ev)
|
super(OsKenDFAdapter, self).switch_features_handler(ev)
|
||||||
version = self.datapath.ofproto.OFP_VERSION
|
version = self.datapath.ofproto.OFP_VERSION
|
||||||
if version < RyuDFAdapter.OF_AUTO_PORT_DESC_STATS_REQ_VER:
|
if version < OsKenDFAdapter.OF_AUTO_PORT_DESC_STATS_REQ_VER:
|
||||||
# Otherwise, this is done automatically by OFPHandler
|
# Otherwise, this is done automatically by OFPHandler
|
||||||
self._send_port_desc_stats_request(self.datapath)
|
self._send_port_desc_stats_request(self.datapath)
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class RyuDFAdapter(ofp_handler.OFPHandler):
|
||||||
self.dispatcher.dispatch('switch_features_handler', ev)
|
self.dispatcher.dispatch('switch_features_handler', ev)
|
||||||
|
|
||||||
if not self.first_connect:
|
if not self.first_connect:
|
||||||
# For reconnecting to the ryu controller, df needs a full sync
|
# For reconnecting to the os_ken controller, df needs a full sync
|
||||||
# in case any resource added during the disconnection.
|
# in case any resource added during the disconnection.
|
||||||
self.db_change_callback(None, None,
|
self.db_change_callback(None, None,
|
||||||
constants.CONTROLLER_REINITIALIZE,
|
constants.CONTROLLER_REINITIALIZE,
|
||||||
|
@ -151,10 +151,10 @@ class RyuDFAdapter(ofp_handler.OFPHandler):
|
||||||
msg = event.msg
|
msg = event.msg
|
||||||
try:
|
try:
|
||||||
(version, msg_type, msg_len, xid) = ofproto_parser.header(msg.data)
|
(version, msg_type, msg_len, xid) = ofproto_parser.header(msg.data)
|
||||||
ryu_msg = ofproto_parser.msg(
|
os_ken_msg = ofproto_parser.msg(
|
||||||
self._datapath, version, msg_type,
|
self._datapath, version, msg_type,
|
||||||
msg_len - ofproto_common.OFP_HEADER_SIZE, xid, msg.data)
|
msg_len - ofproto_common.OFP_HEADER_SIZE, xid, msg.data)
|
||||||
LOG.error('OFPErrorMsg received: %s', ryu_msg)
|
LOG.error('OFPErrorMsg received: %s', os_ken_msg)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.error('Unrecognized OFPErrorMsg received: '
|
LOG.error('Unrecognized OFPErrorMsg received: '
|
||||||
'type=0x%(type)02x code=0x%(code)02x '
|
'type=0x%(type)02x code=0x%(code)02x '
|
||||||
|
@ -184,7 +184,7 @@ class RyuDFAdapter(ofp_handler.OFPHandler):
|
||||||
"""Configure switch for TTL
|
"""Configure switch for TTL
|
||||||
|
|
||||||
Configure the switch to packet-in TTL invalid packets to controller.
|
Configure the switch to packet-in TTL invalid packets to controller.
|
||||||
Note that this method only works in OFP 1.3, however, this ryu app
|
Note that this method only works in OFP 1.3, however, this os_ken app
|
||||||
claims that it only supports ofproto_v1_3.OFP_VERSION. So, no check
|
claims that it only supports ofproto_v1_3.OFP_VERSION. So, no check
|
||||||
will be made here.
|
will be made here.
|
||||||
"""
|
"""
|
|
@ -24,18 +24,18 @@ import greenlet
|
||||||
import netaddr
|
import netaddr
|
||||||
from neutron.agent.common import utils
|
from neutron.agent.common import utils
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.lib.packet import arp
|
||||||
|
from os_ken.lib.packet import dhcp
|
||||||
|
from os_ken.lib.packet import icmp
|
||||||
|
from os_ken.lib.packet import icmpv6
|
||||||
|
from os_ken.lib.packet import ipv4
|
||||||
|
from os_ken.lib.packet import ipv6
|
||||||
|
from os_ken.lib.packet import mpls
|
||||||
|
from os_ken.lib.packet import packet
|
||||||
|
from os_ken.lib.packet import udp
|
||||||
|
from os_ken.lib.packet import vlan
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import pytun
|
import pytun
|
||||||
from ryu.lib.packet import arp
|
|
||||||
from ryu.lib.packet import dhcp
|
|
||||||
from ryu.lib.packet import icmp
|
|
||||||
from ryu.lib.packet import icmpv6
|
|
||||||
from ryu.lib.packet import ipv4
|
|
||||||
from ryu.lib.packet import ipv6
|
|
||||||
from ryu.lib.packet import mpls
|
|
||||||
from ryu.lib.packet import packet
|
|
||||||
from ryu.lib.packet import udp
|
|
||||||
from ryu.lib.packet import vlan
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
|
@ -702,23 +702,23 @@ class ExactMatchFilter(Filter):
|
||||||
return self._fixture == buf
|
return self._fixture == buf
|
||||||
|
|
||||||
|
|
||||||
class RyuIPv4Filter(object):
|
class OsKenIPv4Filter(object):
|
||||||
"""Use ryu to parse the packet and test if it's IPv4."""
|
"""Use os_ken to parse the packet and test if it's IPv4."""
|
||||||
def __call__(self, buf):
|
def __call__(self, buf):
|
||||||
pkt = packet.Packet(buf)
|
pkt = packet.Packet(buf)
|
||||||
return (pkt.get_protocol(ipv4.ipv4) is not None)
|
return (pkt.get_protocol(ipv4.ipv4) is not None)
|
||||||
|
|
||||||
|
|
||||||
class RyuIPv6Filter(object):
|
class OsKenIPv6Filter(object):
|
||||||
"""Use ryu to parse the packet and test if it's IPv6."""
|
"""Use os_ken to parse the packet and test if it's IPv6."""
|
||||||
def __call__(self, buf):
|
def __call__(self, buf):
|
||||||
pkt = packet.Packet(buf)
|
pkt = packet.Packet(buf)
|
||||||
return (pkt.get_protocol(ipv6.ipv6) is not None)
|
return (pkt.get_protocol(ipv6.ipv6) is not None)
|
||||||
|
|
||||||
|
|
||||||
class RyuFilterIcmpv6ProtocolType(object):
|
class OsKenFilterIcmpv6ProtocolType(object):
|
||||||
"""
|
"""
|
||||||
Use ryu to parse the object and see if it from the requested icmpv6 type
|
Use os_ken to parse the object and see if it from the requested icmpv6 type
|
||||||
"""
|
"""
|
||||||
type_ = icmpv6.icmpv6
|
type_ = icmpv6.icmpv6
|
||||||
|
|
||||||
|
@ -730,28 +730,32 @@ class RyuFilterIcmpv6ProtocolType(object):
|
||||||
return pkt_protocol.type_ == self.type_
|
return pkt_protocol.type_ == self.type_
|
||||||
|
|
||||||
|
|
||||||
class RyuNeighborSolicitationFilter(RyuFilterIcmpv6ProtocolType):
|
class OsKenNeighborSolicitationFilter(OsKenFilterIcmpv6ProtocolType):
|
||||||
"""Use ryu to parse the packet and test if it's a Neighbor Solicitaion"""
|
"""Use os_ken to parse the packet and test if it's a Neighbor
|
||||||
|
Solicitaion
|
||||||
|
"""
|
||||||
type_ = icmpv6.ND_NEIGHBOR_SOLICIT
|
type_ = icmpv6.ND_NEIGHBOR_SOLICIT
|
||||||
|
|
||||||
|
|
||||||
class RyuNeighborAdvertisementFilter(RyuFilterIcmpv6ProtocolType):
|
class OsKenNeighborAdvertisementFilter(OsKenFilterIcmpv6ProtocolType):
|
||||||
"""Use ryu to parse the packet and test if it's a Neighbor Advertisement"""
|
"""Use os_ken to parse the packet and test if it's a Neighbor
|
||||||
|
Advertisement
|
||||||
|
"""
|
||||||
type_ = icmpv6.ND_NEIGHBOR_ADVERT
|
type_ = icmpv6.ND_NEIGHBOR_ADVERT
|
||||||
|
|
||||||
|
|
||||||
class RyuRouterSolicitationFilter(RyuFilterIcmpv6ProtocolType):
|
class OsKenRouterSolicitationFilter(OsKenFilterIcmpv6ProtocolType):
|
||||||
"""Use ryu to parse the packet and test if it's a Router Solicitation"""
|
"""Use os_ken to parse the packet and test if it's a Router Solicitation"""
|
||||||
type_ = icmpv6.ND_ROUTER_SOLICIT
|
type_ = icmpv6.ND_ROUTER_SOLICIT
|
||||||
|
|
||||||
|
|
||||||
class RyuIpv6MulticastFilter(RyuFilterIcmpv6ProtocolType):
|
class OsKenIpv6MulticastFilter(OsKenFilterIcmpv6ProtocolType):
|
||||||
"""Use ryu to parse the object and see if it is a multicast request"""
|
"""Use os_ken to parse the object and see if it is a multicast request"""
|
||||||
type_ = icmpv6.MLDV2_LISTENER_REPORT
|
type_ = icmpv6.MLDV2_LISTENER_REPORT
|
||||||
|
|
||||||
|
|
||||||
class RyuARPRequestFilter(object):
|
class OsKenARPRequestFilter(object):
|
||||||
"""Use ryu to parse the packet and test if it's an ARP request."""
|
"""Use os_ken to parse the packet and test if it's an ARP request."""
|
||||||
def __init__(self, arp_tpa=None):
|
def __init__(self, arp_tpa=None):
|
||||||
self.arp_tpa = str(arp_tpa) if arp_tpa else None
|
self.arp_tpa = str(arp_tpa) if arp_tpa else None
|
||||||
|
|
||||||
|
@ -767,8 +771,8 @@ class RyuARPRequestFilter(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class RyuARPReplyFilter(object):
|
class OsKenARPReplyFilter(object):
|
||||||
"""Use ryu to parse the packet and test if it's an ARP reply."""
|
"""Use os_ken to parse the packet and test if it's an ARP reply."""
|
||||||
def __call__(self, buf):
|
def __call__(self, buf):
|
||||||
pkt = packet.Packet(buf)
|
pkt = packet.Packet(buf)
|
||||||
pkt_arp_protocol = pkt.get_protocol(arp.arp)
|
pkt_arp_protocol = pkt.get_protocol(arp.arp)
|
||||||
|
@ -777,8 +781,8 @@ class RyuARPReplyFilter(object):
|
||||||
return pkt_arp_protocol.opcode == 2
|
return pkt_arp_protocol.opcode == 2
|
||||||
|
|
||||||
|
|
||||||
class RyuARPGratuitousFilter(object):
|
class OsKenARPGratuitousFilter(object):
|
||||||
"""Use ryu to parse the packet and test if it's a gratuitous ARP."""
|
"""Use os_ken to parse the packet and test if it's a gratuitous ARP."""
|
||||||
def __call__(self, buf):
|
def __call__(self, buf):
|
||||||
pkt = packet.Packet(buf)
|
pkt = packet.Packet(buf)
|
||||||
pkt_arp_protocol = pkt.get_protocol(arp.arp)
|
pkt_arp_protocol = pkt.get_protocol(arp.arp)
|
||||||
|
@ -794,15 +798,15 @@ def _get_dhcp_message_type_opt(dhcp_packet):
|
||||||
return ord(opt.value)
|
return ord(opt.value)
|
||||||
|
|
||||||
|
|
||||||
class RyuDHCPFilter(object):
|
class OsKenDHCPFilter(object):
|
||||||
"""Use ryu to parse the packet and test if it's a DHCP Ack"""
|
"""Use os_ken to parse the packet and test if it's a DHCP Ack"""
|
||||||
def __call__(self, buf):
|
def __call__(self, buf):
|
||||||
pkt = packet.Packet(buf)
|
pkt = packet.Packet(buf)
|
||||||
return (pkt.get_protocol(dhcp.dhcp) is not None)
|
return (pkt.get_protocol(dhcp.dhcp) is not None)
|
||||||
|
|
||||||
|
|
||||||
class RyuDHCPPacketTypeFilter(object):
|
class OsKenDHCPPacketTypeFilter(object):
|
||||||
"""Use ryu to parse the packet and test if it's a DHCP Ack"""
|
"""Use os_ken to parse the packet and test if it's a DHCP Ack"""
|
||||||
def __call__(self, buf):
|
def __call__(self, buf):
|
||||||
pkt = packet.Packet(buf)
|
pkt = packet.Packet(buf)
|
||||||
pkt_dhcp_protocol = pkt.get_protocol(dhcp.dhcp)
|
pkt_dhcp_protocol = pkt.get_protocol(dhcp.dhcp)
|
||||||
|
@ -815,19 +819,19 @@ class RyuDHCPPacketTypeFilter(object):
|
||||||
raise Exception('DHCP packet type filter not fully implemented')
|
raise Exception('DHCP packet type filter not fully implemented')
|
||||||
|
|
||||||
|
|
||||||
class RyuDHCPOfferFilter(RyuDHCPPacketTypeFilter):
|
class OsKenDHCPOfferFilter(OsKenDHCPPacketTypeFilter):
|
||||||
def get_dhcp_packet_type(self):
|
def get_dhcp_packet_type(self):
|
||||||
return dhcp.DHCP_OFFER
|
return dhcp.DHCP_OFFER
|
||||||
|
|
||||||
|
|
||||||
class RyuDHCPAckFilter(RyuDHCPPacketTypeFilter):
|
class OsKenDHCPAckFilter(OsKenDHCPPacketTypeFilter):
|
||||||
def get_dhcp_packet_type(self):
|
def get_dhcp_packet_type(self):
|
||||||
return dhcp.DHCP_ACK
|
return dhcp.DHCP_ACK
|
||||||
|
|
||||||
|
|
||||||
class RyuICMPFilter(object):
|
class OsKenICMPFilter(object):
|
||||||
def __init__(self, ethertype=n_const.IPv4):
|
def __init__(self, ethertype=n_const.IPv4):
|
||||||
super(RyuICMPFilter, self).__init__()
|
super(OsKenICMPFilter, self).__init__()
|
||||||
self.ethertype = ethertype
|
self.ethertype = ethertype
|
||||||
|
|
||||||
def __call__(self, buf):
|
def __call__(self, buf):
|
||||||
|
@ -853,14 +857,14 @@ class RyuICMPFilter(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class RyuICMPPingFilter(RyuICMPFilter):
|
class OsKenICMPPingFilter(OsKenICMPFilter):
|
||||||
"""
|
"""
|
||||||
A filter to detect ICMP echo request messages.
|
A filter to detect ICMP echo request messages.
|
||||||
:param get_ping: Return an object contained the original echo request
|
:param get_ping: Return an object contained the original echo request
|
||||||
:type get_ping: Callable with no arguments.
|
:type get_ping: Callable with no arguments.
|
||||||
"""
|
"""
|
||||||
def __init__(self, get_ping=None, ethertype=n_const.IPv4):
|
def __init__(self, get_ping=None, ethertype=n_const.IPv4):
|
||||||
super(RyuICMPPingFilter, self).__init__()
|
super(OsKenICMPPingFilter, self).__init__()
|
||||||
self.get_ping = get_ping
|
self.get_ping = get_ping
|
||||||
self.ethertype = ethertype
|
self.ethertype = ethertype
|
||||||
|
|
||||||
|
@ -877,18 +881,18 @@ class RyuICMPPingFilter(RyuICMPFilter):
|
||||||
result = True
|
result = True
|
||||||
if self.get_ping is not None:
|
if self.get_ping is not None:
|
||||||
ping = self.get_ping()
|
ping = self.get_ping()
|
||||||
result = super(RyuICMPPingFilter, self).is_same_icmp(proto, ping)
|
result = super(OsKenICMPPingFilter, self).is_same_icmp(proto, ping)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class RyuICMPPongFilter(RyuICMPFilter):
|
class OsKenICMPPongFilter(OsKenICMPFilter):
|
||||||
"""
|
"""
|
||||||
A filter to detect ICMP echo reply messages.
|
A filter to detect ICMP echo reply messages.
|
||||||
:param get_ping: Return an object contained the original echo request
|
:param get_ping: Return an object contained the original echo request
|
||||||
:type get_ping: Callable with no arguments.
|
:type get_ping: Callable with no arguments.
|
||||||
"""
|
"""
|
||||||
def __init__(self, get_ping, ethertype=n_const.IPv4):
|
def __init__(self, get_ping, ethertype=n_const.IPv4):
|
||||||
super(RyuICMPPongFilter, self).__init__()
|
super(OsKenICMPPongFilter, self).__init__()
|
||||||
self.get_ping = get_ping
|
self.get_ping = get_ping
|
||||||
self.ethertype = ethertype
|
self.ethertype = ethertype
|
||||||
|
|
||||||
|
@ -903,17 +907,17 @@ class RyuICMPPongFilter(RyuICMPFilter):
|
||||||
if proto_type != icmp_req:
|
if proto_type != icmp_req:
|
||||||
return False
|
return False
|
||||||
ping = self.get_ping()
|
ping = self.get_ping()
|
||||||
return super(RyuICMPPongFilter, self).is_same_icmp(icmp_prot, ping)
|
return super(OsKenICMPPongFilter, self).is_same_icmp(icmp_prot, ping)
|
||||||
|
|
||||||
|
|
||||||
class RyuICMPTimeExceedFilter(RyuICMPFilter):
|
class OsKenICMPTimeExceedFilter(OsKenICMPFilter):
|
||||||
"""
|
"""
|
||||||
A filter to detect ICMP time exceed messages.
|
A filter to detect ICMP time exceed messages.
|
||||||
:param get_ip: Return an object contained the original IP header
|
:param get_ip: Return an object contained the original IP header
|
||||||
:type get_ip: Callable with no arguments.
|
:type get_ip: Callable with no arguments.
|
||||||
"""
|
"""
|
||||||
def __init__(self, get_ip):
|
def __init__(self, get_ip):
|
||||||
super(RyuICMPTimeExceedFilter, self).__init__()
|
super(OsKenICMPTimeExceedFilter, self).__init__()
|
||||||
self.get_ip = get_ip
|
self.get_ip = get_ip
|
||||||
|
|
||||||
def filter_icmp(self, pkt, icmp_prot):
|
def filter_icmp(self, pkt, icmp_prot):
|
||||||
|
@ -929,14 +933,14 @@ class RyuICMPTimeExceedFilter(RyuICMPFilter):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class RyuICMPUnreachFilter(RyuICMPFilter):
|
class OsKenICMPUnreachFilter(OsKenICMPFilter):
|
||||||
"""
|
"""
|
||||||
A filter to detect ICMP unreachable messages.
|
A filter to detect ICMP unreachable messages.
|
||||||
:param get_ip: Return an object contained the original IP header
|
:param get_ip: Return an object contained the original IP header
|
||||||
:type get_ip: Callable with no arguments.
|
:type get_ip: Callable with no arguments.
|
||||||
"""
|
"""
|
||||||
def __init__(self, get_ip):
|
def __init__(self, get_ip):
|
||||||
super(RyuICMPUnreachFilter, self).__init__()
|
super(OsKenICMPUnreachFilter, self).__init__()
|
||||||
self.get_ip = get_ip
|
self.get_ip = get_ip
|
||||||
|
|
||||||
def filter_icmp(self, pkt, icmp_prot):
|
def filter_icmp(self, pkt, icmp_prot):
|
||||||
|
@ -952,7 +956,7 @@ class RyuICMPUnreachFilter(RyuICMPFilter):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class RyuVLANTagFilter(object):
|
class OsKenVLANTagFilter(object):
|
||||||
"""
|
"""
|
||||||
A filter that detects a VLAN tagged packet
|
A filter that detects a VLAN tagged packet
|
||||||
:param tag: The VLAN tag to detect. None for any
|
:param tag: The VLAN tag to detect. None for any
|
||||||
|
@ -980,7 +984,7 @@ class AndingFilter(object):
|
||||||
return all(filter_(buf) for filter_ in self.filters)
|
return all(filter_(buf) for filter_ in self.filters)
|
||||||
|
|
||||||
|
|
||||||
class RyuMplsFilter(object):
|
class OsKenMplsFilter(object):
|
||||||
def __init__(self, label=None):
|
def __init__(self, label=None):
|
||||||
self._label = label
|
self._label = label
|
||||||
|
|
||||||
|
@ -997,7 +1001,7 @@ class RyuMplsFilter(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class RyuUdpFilter(object):
|
class OsKenUdpFilter(object):
|
||||||
def __init__(self, dst_port=None):
|
def __init__(self, dst_port=None):
|
||||||
self._dst_port = dst_port
|
self._dst_port = dst_port
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import os_ken.lib.packet
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import ryu.lib.packet
|
|
||||||
|
|
||||||
from dragonflow.db.models import active_port
|
from dragonflow.db.models import active_port
|
||||||
from dragonflow.tests.common import app_testing_objects
|
from dragonflow.tests.common import app_testing_objects
|
||||||
|
@ -34,7 +34,7 @@ class TestAllowedAddressPairsDetectActive(test_base.DFTestBase):
|
||||||
rules=[
|
rules=[
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect arp requests
|
# Detect arp requests
|
||||||
app_testing_objects.RyuARPRequestFilter(
|
app_testing_objects.OsKenARPRequestFilter(
|
||||||
self.allowed_address_pair_ip_address
|
self.allowed_address_pair_ip_address
|
||||||
),
|
),
|
||||||
actions=[
|
actions=[
|
||||||
|
@ -94,9 +94,9 @@ class TestAllowedAddressPairsDetectActive(test_base.DFTestBase):
|
||||||
self.addCleanup(self.policy.close)
|
self.addCleanup(self.policy.close)
|
||||||
|
|
||||||
def _create_arp_response(self, buf):
|
def _create_arp_response(self, buf):
|
||||||
pkt = ryu.lib.packet.packet.Packet(buf)
|
pkt = os_ken.lib.packet.packet.Packet(buf)
|
||||||
ether = pkt.get_protocol(ryu.lib.packet.ethernet.ethernet)
|
ether = pkt.get_protocol(os_ken.lib.packet.ethernet.ethernet)
|
||||||
arp = pkt.get_protocol(ryu.lib.packet.arp.arp)
|
arp = pkt.get_protocol(os_ken.lib.packet.arp.arp)
|
||||||
|
|
||||||
ether.src, ether.dst = self.allowed_address_pair_mac_address, ether.src
|
ether.src, ether.dst = self.allowed_address_pair_mac_address, ether.src
|
||||||
|
|
||||||
|
@ -108,13 +108,13 @@ class TestAllowedAddressPairsDetectActive(test_base.DFTestBase):
|
||||||
arp_spa = self.allowed_address_pair_ip_address
|
arp_spa = self.allowed_address_pair_ip_address
|
||||||
arp_tha = arp.src_mac
|
arp_tha = arp.src_mac
|
||||||
arp_tpa = arp.src_ip
|
arp_tpa = arp.src_ip
|
||||||
arp.opcode = ryu.lib.packet.arp.ARP_REPLY
|
arp.opcode = os_ken.lib.packet.arp.ARP_REPLY
|
||||||
arp.src_mac = arp_sha
|
arp.src_mac = arp_sha
|
||||||
arp.src_ip = arp_spa
|
arp.src_ip = arp_spa
|
||||||
arp.dst_mac = arp_tha
|
arp.dst_mac = arp_tha
|
||||||
arp.dst_ip = arp_tpa
|
arp.dst_ip = arp_tpa
|
||||||
|
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ether)
|
result.add_protocol(ether)
|
||||||
result.add_protocol(arp)
|
result.add_protocol(arp)
|
||||||
result.serialize()
|
result.serialize()
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
import struct
|
import struct
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import os_ken.lib.packet
|
||||||
|
from os_ken.lib.packet import dhcp
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import ryu.lib.packet
|
|
||||||
from ryu.lib.packet import dhcp
|
|
||||||
|
|
||||||
from dragonflow.controller.common import constants
|
from dragonflow.controller.common import constants
|
||||||
from dragonflow.tests.common import app_testing_objects
|
from dragonflow.tests.common import app_testing_objects
|
||||||
|
@ -42,21 +42,21 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
dst_mac=constants.BROADCAST_MAC,
|
dst_mac=constants.BROADCAST_MAC,
|
||||||
src_ip='0.0.0.0',
|
src_ip='0.0.0.0',
|
||||||
dst_ip=constants.BROADCAST_IP):
|
dst_ip=constants.BROADCAST_IP):
|
||||||
ethernet = ryu.lib.packet.ethernet.ethernet(
|
ethernet = os_ken.lib.packet.ethernet.ethernet(
|
||||||
src=str(self.port1.port.get_logical_port().mac),
|
src=str(self.port1.port.get_logical_port().mac),
|
||||||
dst=str(dst_mac),
|
dst=str(dst_mac),
|
||||||
ethertype=ryu.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
ethertype=os_ken.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
||||||
)
|
)
|
||||||
ip = ryu.lib.packet.ipv4.ipv4(
|
ip = os_ken.lib.packet.ipv4.ipv4(
|
||||||
src=str(src_ip),
|
src=str(src_ip),
|
||||||
dst=str(dst_ip),
|
dst=str(dst_ip),
|
||||||
proto=ryu.lib.packet.ipv4.inet.IPPROTO_UDP,
|
proto=os_ken.lib.packet.ipv4.inet.IPPROTO_UDP,
|
||||||
)
|
)
|
||||||
udp = ryu.lib.packet.udp.udp(
|
udp = os_ken.lib.packet.udp.udp(
|
||||||
src_port=constants.DHCP_CLIENT_PORT,
|
src_port=constants.DHCP_CLIENT_PORT,
|
||||||
dst_port=constants.DHCP_SERVER_PORT,
|
dst_port=constants.DHCP_SERVER_PORT,
|
||||||
)
|
)
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ethernet)
|
result.add_protocol(ethernet)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
result.add_protocol(udp)
|
result.add_protocol(udp)
|
||||||
|
@ -65,19 +65,19 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
def _create_dhcp_discover(self):
|
def _create_dhcp_discover(self):
|
||||||
result = self._create_udp_packet_for_dhcp()
|
result = self._create_udp_packet_for_dhcp()
|
||||||
options = [
|
options = [
|
||||||
ryu.lib.packet.dhcp.option(
|
os_ken.lib.packet.dhcp.option(
|
||||||
ryu.lib.packet.dhcp.DHCP_MESSAGE_TYPE_OPT,
|
os_ken.lib.packet.dhcp.DHCP_MESSAGE_TYPE_OPT,
|
||||||
chr(ryu.lib.packet.dhcp.DHCP_DISCOVER),
|
chr(os_ken.lib.packet.dhcp.DHCP_DISCOVER),
|
||||||
),
|
),
|
||||||
ryu.lib.packet.dhcp.option(
|
os_ken.lib.packet.dhcp.option(
|
||||||
ryu.lib.packet.dhcp.DHCP_PARAMETER_REQUEST_LIST_OPT,
|
os_ken.lib.packet.dhcp.DHCP_PARAMETER_REQUEST_LIST_OPT,
|
||||||
chr(ryu.lib.packet.dhcp.DHCP_GATEWAY_ADDR_OPT),
|
chr(os_ken.lib.packet.dhcp.DHCP_GATEWAY_ADDR_OPT),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
dhcp = ryu.lib.packet.dhcp.dhcp(
|
dhcp = os_ken.lib.packet.dhcp.dhcp(
|
||||||
op=1,
|
op=1,
|
||||||
chaddr=str(self.port1.port.get_logical_port().mac),
|
chaddr=str(self.port1.port.get_logical_port().mac),
|
||||||
options=ryu.lib.packet.dhcp.options(option_list=options),
|
options=os_ken.lib.packet.dhcp.options(option_list=options),
|
||||||
)
|
)
|
||||||
result.add_protocol(dhcp)
|
result.add_protocol(dhcp)
|
||||||
result.serialize()
|
result.serialize()
|
||||||
|
@ -90,16 +90,16 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
pkt = ryu.lib.packet.packet.Packet(offer_buf)
|
pkt = os_ken.lib.packet.packet.Packet(offer_buf)
|
||||||
offer = pkt.get_protocol(ryu.lib.packet.dhcp.dhcp)
|
offer = pkt.get_protocol(os_ken.lib.packet.dhcp.dhcp)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
str(self.port1.port.get_logical_port().ip),
|
str(self.port1.port.get_logical_port().ip),
|
||||||
offer.yiaddr
|
offer.yiaddr
|
||||||
)
|
)
|
||||||
self.assertTrue(is_121_exist(offer))
|
self.assertTrue(is_121_exist(offer))
|
||||||
if is_renewal:
|
if is_renewal:
|
||||||
ether = pkt.get_protocol(ryu.lib.packet.ethernet.ethernet)
|
ether = pkt.get_protocol(os_ken.lib.packet.ethernet.ethernet)
|
||||||
ip = pkt.get_protocol(ryu.lib.packet.ipv4.ipv4)
|
ip = pkt.get_protocol(os_ken.lib.packet.ipv4.ipv4)
|
||||||
dst_mac = ether.src
|
dst_mac = ether.src
|
||||||
dst_ip = ip.src
|
dst_ip = ip.src
|
||||||
src_ip = self.port1.port.get_logical_port().ip
|
src_ip = self.port1.port.get_logical_port().ip
|
||||||
|
@ -111,24 +111,24 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
else:
|
else:
|
||||||
result = self._create_udp_packet_for_dhcp()
|
result = self._create_udp_packet_for_dhcp()
|
||||||
options = [
|
options = [
|
||||||
ryu.lib.packet.dhcp.option(
|
os_ken.lib.packet.dhcp.option(
|
||||||
ryu.lib.packet.dhcp.DHCP_MESSAGE_TYPE_OPT,
|
os_ken.lib.packet.dhcp.DHCP_MESSAGE_TYPE_OPT,
|
||||||
chr(ryu.lib.packet.dhcp.DHCP_REQUEST),
|
chr(os_ken.lib.packet.dhcp.DHCP_REQUEST),
|
||||||
),
|
),
|
||||||
ryu.lib.packet.dhcp.option(
|
os_ken.lib.packet.dhcp.option(
|
||||||
ryu.lib.packet.dhcp.DHCP_REQUESTED_IP_ADDR_OPT,
|
os_ken.lib.packet.dhcp.DHCP_REQUESTED_IP_ADDR_OPT,
|
||||||
offer.yiaddr,
|
offer.yiaddr,
|
||||||
),
|
),
|
||||||
ryu.lib.packet.dhcp.option(
|
os_ken.lib.packet.dhcp.option(
|
||||||
ryu.lib.packet.dhcp.DHCP_PARAMETER_REQUEST_LIST_OPT,
|
os_ken.lib.packet.dhcp.DHCP_PARAMETER_REQUEST_LIST_OPT,
|
||||||
chr(ryu.lib.packet.dhcp.DHCP_GATEWAY_ADDR_OPT),
|
chr(os_ken.lib.packet.dhcp.DHCP_GATEWAY_ADDR_OPT),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
dhcp = ryu.lib.packet.dhcp.dhcp(
|
dhcp = os_ken.lib.packet.dhcp.dhcp(
|
||||||
op=1,
|
op=1,
|
||||||
chaddr=str(self.port1.port.get_logical_port().mac),
|
chaddr=str(self.port1.port.get_logical_port().mac),
|
||||||
xid=offer.xid,
|
xid=offer.xid,
|
||||||
options=ryu.lib.packet.dhcp.options(option_list=options),
|
options=os_ken.lib.packet.dhcp.options(option_list=options),
|
||||||
)
|
)
|
||||||
result.add_protocol(dhcp)
|
result.add_protocol(dhcp)
|
||||||
result.serialize()
|
result.serialize()
|
||||||
|
@ -149,7 +149,7 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
|
|
||||||
testclass = self
|
testclass = self
|
||||||
|
|
||||||
class DHCPAckFilterVerifiesMTU(app_testing_objects.RyuDHCPAckFilter):
|
class DHCPAckFilterVerifiesMTU(app_testing_objects.OsKenDHCPAckFilter):
|
||||||
|
|
||||||
def __init__(self, expected_mtu):
|
def __init__(self, expected_mtu):
|
||||||
super(DHCPAckFilterVerifiesMTU, self).__init__()
|
super(DHCPAckFilterVerifiesMTU, self).__init__()
|
||||||
|
@ -159,7 +159,7 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
result = super(DHCPAckFilterVerifiesMTU, self).__call__(buf)
|
result = super(DHCPAckFilterVerifiesMTU, self).__call__(buf)
|
||||||
if not result:
|
if not result:
|
||||||
return result
|
return result
|
||||||
pkt = ryu.lib.packet.packet.Packet(buf)
|
pkt = os_ken.lib.packet.packet.Packet(buf)
|
||||||
pkt_dhcp_protocol = pkt.get_protocol(dhcp.dhcp)
|
pkt_dhcp_protocol = pkt.get_protocol(dhcp.dhcp)
|
||||||
for option in pkt_dhcp_protocol.options.option_list:
|
for option in pkt_dhcp_protocol.options.option_list:
|
||||||
if option.tag == dhcp.DHCP_INTERFACE_MTU_OPT:
|
if option.tag == dhcp.DHCP_INTERFACE_MTU_OPT:
|
||||||
|
@ -174,7 +174,7 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
rules1 = [
|
rules1 = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect dhcp offer
|
# Detect dhcp offer
|
||||||
app_testing_objects.RyuDHCPOfferFilter(),
|
app_testing_objects.OsKenDHCPOfferFilter(),
|
||||||
actions
|
actions
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
|
@ -200,7 +200,7 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -210,7 +210,7 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
rules2 = [
|
rules2 = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect arp replies
|
# Detect arp replies
|
||||||
app_testing_objects.RyuDHCPFilter(),
|
app_testing_objects.OsKenDHCPFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
app_testing_objects.RaiseAction(
|
app_testing_objects.RaiseAction(
|
||||||
"Received DHCP packet"
|
"Received DHCP packet"
|
||||||
|
@ -219,7 +219,7 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -292,7 +292,7 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
rules = [
|
rules = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect arp replies
|
# Detect arp replies
|
||||||
app_testing_objects.RyuDHCPFilter(),
|
app_testing_objects.OsKenDHCPFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
app_testing_objects.RaiseAction(
|
app_testing_objects.RaiseAction(
|
||||||
"Received DHCP packet"
|
"Received DHCP packet"
|
||||||
|
@ -301,7 +301,7 @@ class TestDHCPApp(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
app_testing_objects.IgnoreAction()
|
app_testing_objects.IgnoreAction()
|
||||||
]
|
]
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import os_ken.lib.packet
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import ryu.lib.packet
|
|
||||||
|
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
from dragonflow.tests.common import app_testing_objects
|
from dragonflow.tests.common import app_testing_objects
|
||||||
|
@ -57,14 +57,14 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -83,29 +83,29 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
router_interface_port = self.neutron.show_port(
|
router_interface_port = self.neutron.show_port(
|
||||||
router_interface['port_id']
|
router_interface['port_id']
|
||||||
)
|
)
|
||||||
ethernet = ryu.lib.packet.ethernet.ethernet(
|
ethernet = os_ken.lib.packet.ethernet.ethernet(
|
||||||
src=str(self.port.port.get_logical_port().mac),
|
src=str(self.port.port.get_logical_port().mac),
|
||||||
dst=str(router_interface_port['port']['mac_address']),
|
dst=str(router_interface_port['port']['mac_address']),
|
||||||
ethertype=ryu.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
ethertype=os_ken.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
||||||
)
|
)
|
||||||
ip = ryu.lib.packet.ipv4.ipv4(
|
ip = os_ken.lib.packet.ipv4.ipv4(
|
||||||
src=str(self.port.port.get_logical_port().ip),
|
src=str(self.port.port.get_logical_port().ip),
|
||||||
dst=str(dst_ip),
|
dst=str(dst_ip),
|
||||||
ttl=ttl,
|
ttl=ttl,
|
||||||
proto=proto,
|
proto=proto,
|
||||||
)
|
)
|
||||||
if proto == ryu.lib.packet.ipv4.inet.IPPROTO_ICMP:
|
if proto == os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP:
|
||||||
ip_data = ryu.lib.packet.icmp.icmp(
|
ip_data = os_ken.lib.packet.icmp.icmp(
|
||||||
type_=ryu.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
type_=os_ken.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
||||||
data=ryu.lib.packet.icmp.echo(
|
data=os_ken.lib.packet.icmp.echo(
|
||||||
data=self._create_random_string())
|
data=self._create_random_string())
|
||||||
)
|
)
|
||||||
elif proto == ryu.lib.packet.ipv4.inet.IPPROTO_UDP:
|
elif proto == os_ken.lib.packet.ipv4.inet.IPPROTO_UDP:
|
||||||
ip_data = ryu.lib.packet.udp.udp(
|
ip_data = os_ken.lib.packet.udp.udp(
|
||||||
dst_port=33534,
|
dst_port=33534,
|
||||||
)
|
)
|
||||||
self._ip = ip
|
self._ip = ip
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ethernet)
|
result.add_protocol(ethernet)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
result.add_protocol(ip_data)
|
result.add_protocol(ip_data)
|
||||||
|
@ -119,7 +119,7 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
ignore_action = app_testing_objects.IgnoreAction()
|
ignore_action = app_testing_objects.IgnoreAction()
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
self.topology.external_network.get_gw_ip(),
|
self.topology.external_network.get_gw_ip(),
|
||||||
ryu.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
||||||
ttl=1)
|
ttl=1)
|
||||||
policy = app_testing_objects.Policy(
|
policy = app_testing_objects.Policy(
|
||||||
initial_actions=[
|
initial_actions=[
|
||||||
|
@ -130,7 +130,7 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
port_policies=self._create_icmp_test_port_policies(
|
port_policies=self._create_icmp_test_port_policies(
|
||||||
app_testing_objects.RyuICMPTimeExceedFilter),
|
app_testing_objects.OsKenICMPTimeExceedFilter),
|
||||||
unknown_port_action=ignore_action
|
unknown_port_action=ignore_action
|
||||||
)
|
)
|
||||||
self.addCleanup(policy.close)
|
self.addCleanup(policy.close)
|
||||||
|
@ -154,12 +154,12 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[ignore_action]
|
actions=[ignore_action]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[ignore_action]
|
actions=[ignore_action]
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -172,7 +172,7 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
def test_ttl_packet_rate_limit(self):
|
def test_ttl_packet_rate_limit(self):
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
self.topology.external_network.get_gw_ip(),
|
self.topology.external_network.get_gw_ip(),
|
||||||
ryu.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
||||||
ttl=1)
|
ttl=1)
|
||||||
send_action = app_testing_objects.SendAction(
|
send_action = app_testing_objects.SendAction(
|
||||||
self.subnet.subnet_id,
|
self.subnet.subnet_id,
|
||||||
|
@ -188,7 +188,7 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
],
|
],
|
||||||
port_policies=self._create_rate_limit_port_policies(
|
port_policies=self._create_rate_limit_port_policies(
|
||||||
cfg.CONF.df_dnat_app.dnat_ttl_invalid_max_rate,
|
cfg.CONF.df_dnat_app.dnat_ttl_invalid_max_rate,
|
||||||
app_testing_objects.RyuICMPTimeExceedFilter),
|
app_testing_objects.OsKenICMPTimeExceedFilter),
|
||||||
unknown_port_action=ignore_action
|
unknown_port_action=ignore_action
|
||||||
)
|
)
|
||||||
self.addCleanup(policy.close)
|
self.addCleanup(policy.close)
|
||||||
|
@ -208,7 +208,7 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
|
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
self.topology.external_network.get_gw_ip(),
|
self.topology.external_network.get_gw_ip(),
|
||||||
ryu.lib.packet.ipv4.inet.IPPROTO_UDP)
|
os_ken.lib.packet.ipv4.inet.IPPROTO_UDP)
|
||||||
policy = app_testing_objects.Policy(
|
policy = app_testing_objects.Policy(
|
||||||
initial_actions=[
|
initial_actions=[
|
||||||
app_testing_objects.SendAction(
|
app_testing_objects.SendAction(
|
||||||
|
@ -218,7 +218,7 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
port_policies=self._create_icmp_test_port_policies(
|
port_policies=self._create_icmp_test_port_policies(
|
||||||
app_testing_objects.RyuICMPUnreachFilter),
|
app_testing_objects.OsKenICMPUnreachFilter),
|
||||||
unknown_port_action=ignore_action
|
unknown_port_action=ignore_action
|
||||||
)
|
)
|
||||||
self.addCleanup(policy.close)
|
self.addCleanup(policy.close)
|
||||||
|
@ -231,7 +231,7 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
self.port.port.update({"security_groups": []})
|
self.port.port.update({"security_groups": []})
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
self.topology.external_network.get_gw_ip(),
|
self.topology.external_network.get_gw_ip(),
|
||||||
ryu.lib.packet.ipv4.inet.IPPROTO_UDP)
|
os_ken.lib.packet.ipv4.inet.IPPROTO_UDP)
|
||||||
send_action = app_testing_objects.SendAction(
|
send_action = app_testing_objects.SendAction(
|
||||||
self.subnet.subnet_id,
|
self.subnet.subnet_id,
|
||||||
self.port.port_id,
|
self.port.port_id,
|
||||||
|
@ -246,7 +246,7 @@ class TestDNATApp(test_base.DFTestBase):
|
||||||
],
|
],
|
||||||
port_policies=self._create_rate_limit_port_policies(
|
port_policies=self._create_rate_limit_port_policies(
|
||||||
cfg.CONF.df_dnat_app.dnat_icmp_error_max_rate,
|
cfg.CONF.df_dnat_app.dnat_icmp_error_max_rate,
|
||||||
app_testing_objects.RyuICMPUnreachFilter),
|
app_testing_objects.OsKenICMPUnreachFilter),
|
||||||
unknown_port_action=ignore_action
|
unknown_port_action=ignore_action
|
||||||
)
|
)
|
||||||
self.addCleanup(policy.close)
|
self.addCleanup(policy.close)
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from neutron.agent.common import utils
|
from neutron.agent.common import utils
|
||||||
|
import os_ken.lib.packet
|
||||||
|
from os_ken.ofproto import inet
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import ryu.lib.packet
|
|
||||||
from ryu.ofproto import inet
|
|
||||||
|
|
||||||
from dragonflow.controller.common import constants
|
from dragonflow.controller.common import constants
|
||||||
from dragonflow.tests.common import app_testing_objects
|
from dragonflow.tests.common import app_testing_objects
|
||||||
|
@ -60,7 +60,7 @@ class TestArpResponder(test_base.DFTestBase):
|
||||||
rules=[
|
rules=[
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect arp replies
|
# Detect arp replies
|
||||||
app_testing_objects.RyuARPReplyFilter(),
|
app_testing_objects.OsKenARPReplyFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
log_action,
|
log_action,
|
||||||
app_testing_objects.StopSimulationAction()
|
app_testing_objects.StopSimulationAction()
|
||||||
|
@ -68,7 +68,7 @@ class TestArpResponder(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -87,17 +87,17 @@ class TestArpResponder(test_base.DFTestBase):
|
||||||
self.addCleanup(self.policy.close)
|
self.addCleanup(self.policy.close)
|
||||||
|
|
||||||
def _create_arp_request(self, src_port, dst_port):
|
def _create_arp_request(self, src_port, dst_port):
|
||||||
ethernet = ryu.lib.packet.ethernet.ethernet(
|
ethernet = os_ken.lib.packet.ethernet.ethernet(
|
||||||
src=str(src_port.mac),
|
src=str(src_port.mac),
|
||||||
dst=str(constants.BROADCAST_MAC),
|
dst=str(constants.BROADCAST_MAC),
|
||||||
ethertype=ryu.lib.packet.ethernet.ether.ETH_TYPE_ARP,
|
ethertype=os_ken.lib.packet.ethernet.ether.ETH_TYPE_ARP,
|
||||||
)
|
)
|
||||||
arp = ryu.lib.packet.arp.arp_ip(
|
arp = os_ken.lib.packet.arp.arp_ip(
|
||||||
opcode=ryu.lib.packet.arp.ARP_REQUEST,
|
opcode=os_ken.lib.packet.arp.ARP_REQUEST,
|
||||||
src_mac=str(src_port.mac), src_ip=str(src_port.ip),
|
src_mac=str(src_port.mac), src_ip=str(src_port.ip),
|
||||||
dst_mac='00:00:00:00:00:00', dst_ip=str(dst_port.ip),
|
dst_mac='00:00:00:00:00:00', dst_ip=str(dst_port.ip),
|
||||||
)
|
)
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ethernet)
|
result.add_protocol(ethernet)
|
||||||
result.add_protocol(arp)
|
result.add_protocol(arp)
|
||||||
result.serialize()
|
result.serialize()
|
||||||
|
@ -161,7 +161,7 @@ class TestNeighborAdvertiser(test_base.DFTestBase):
|
||||||
ignore_action = app_testing_objects.IgnoreAction()
|
ignore_action = app_testing_objects.IgnoreAction()
|
||||||
log_action = app_testing_objects.LogAction()
|
log_action = app_testing_objects.LogAction()
|
||||||
key1 = (subnet1.subnet_id, port1.port_id)
|
key1 = (subnet1.subnet_id, port1.port_id)
|
||||||
adv_filter = app_testing_objects.RyuNeighborAdvertisementFilter()
|
adv_filter = app_testing_objects.OsKenNeighborAdvertisementFilter()
|
||||||
port_policies = {
|
port_policies = {
|
||||||
key1: app_testing_objects.PortPolicy(
|
key1: app_testing_objects.PortPolicy(
|
||||||
rules=[
|
rules=[
|
||||||
|
@ -175,7 +175,7 @@ class TestNeighborAdvertiser(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Filter local VM's Multicast requests
|
# Filter local VM's Multicast requests
|
||||||
app_testing_objects.RyuIpv6MulticastFilter(),
|
app_testing_objects.OsKenIpv6MulticastFilter(),
|
||||||
actions=[ignore_action]
|
actions=[ignore_action]
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
@ -192,23 +192,23 @@ class TestNeighborAdvertiser(test_base.DFTestBase):
|
||||||
self.addCleanup(self.policy.close)
|
self.addCleanup(self.policy.close)
|
||||||
|
|
||||||
def _create_ns_request(self, src_port, dst_port):
|
def _create_ns_request(self, src_port, dst_port):
|
||||||
ethernet = ryu.lib.packet.ethernet.ethernet(
|
ethernet = os_ken.lib.packet.ethernet.ethernet(
|
||||||
src=str(src_port.mac),
|
src=str(src_port.mac),
|
||||||
dst=str(constants.BROADCAST_MAC),
|
dst=str(constants.BROADCAST_MAC),
|
||||||
ethertype=ryu.lib.packet.ethernet.ether.ETH_TYPE_IPV6,
|
ethertype=os_ken.lib.packet.ethernet.ether.ETH_TYPE_IPV6,
|
||||||
)
|
)
|
||||||
ipv6 = ryu.lib.packet.ipv6.ipv6(
|
ipv6 = os_ken.lib.packet.ipv6.ipv6(
|
||||||
src=str(src_port.ip),
|
src=str(src_port.ip),
|
||||||
dst=str(dst_port.ip),
|
dst=str(dst_port.ip),
|
||||||
nxt=inet.IPPROTO_ICMPV6
|
nxt=inet.IPPROTO_ICMPV6
|
||||||
)
|
)
|
||||||
icmpv6 = ryu.lib.packet.icmpv6.icmpv6(
|
icmpv6 = os_ken.lib.packet.icmpv6.icmpv6(
|
||||||
type_=ryu.lib.packet.icmpv6.ND_NEIGHBOR_SOLICIT,
|
type_=os_ken.lib.packet.icmpv6.ND_NEIGHBOR_SOLICIT,
|
||||||
data=ryu.lib.packet.icmpv6.nd_neighbor(
|
data=os_ken.lib.packet.icmpv6.nd_neighbor(
|
||||||
dst=str(dst_port.ip)
|
dst=str(dst_port.ip)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ethernet)
|
result.add_protocol(ethernet)
|
||||||
result.add_protocol(ipv6)
|
result.add_protocol(ipv6)
|
||||||
result.add_protocol(icmpv6)
|
result.add_protocol(icmpv6)
|
||||||
|
|
|
@ -15,8 +15,8 @@ import netaddr
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from neutron.agent.common import utils
|
from neutron.agent.common import utils
|
||||||
|
import os_ken.lib.packet
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import ryu.lib.packet
|
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
|
@ -63,19 +63,19 @@ class TestL3App(test_base.DFTestBase):
|
||||||
rules1 = [
|
rules1 = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect pong, end simulation
|
# Detect pong, end simulation
|
||||||
app_testing_objects.RyuICMPPongFilter(self._get_ping),
|
app_testing_objects.OsKenICMPPongFilter(self._get_ping),
|
||||||
actions=actions
|
actions=actions
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -94,12 +94,12 @@ class TestL3App(test_base.DFTestBase):
|
||||||
rules2 = [
|
rules2 = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect ping, reply with pong
|
# Detect ping, reply with pong
|
||||||
app_testing_objects.RyuICMPPingFilter(),
|
app_testing_objects.OsKenICMPPingFilter(),
|
||||||
actions=actions
|
actions=actions
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -107,14 +107,14 @@ class TestL3App(test_base.DFTestBase):
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore ARP requests from active port detection app for
|
# Ignore ARP requests from active port detection app for
|
||||||
# ports with allowed_address_pairs
|
# ports with allowed_address_pairs
|
||||||
app_testing_objects.RyuARPRequestFilter(),
|
app_testing_objects.OsKenARPRequestFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -140,30 +140,30 @@ class TestL3App(test_base.DFTestBase):
|
||||||
router_interface_port = self.neutron.show_port(
|
router_interface_port = self.neutron.show_port(
|
||||||
router_interface['port_id']
|
router_interface['port_id']
|
||||||
)
|
)
|
||||||
ethernet = ryu.lib.packet.ethernet.ethernet(
|
ethernet = os_ken.lib.packet.ethernet.ethernet(
|
||||||
src=self.port1.port.get_logical_port().mac,
|
src=self.port1.port.get_logical_port().mac,
|
||||||
dst=router_interface_port['port']['mac_address'],
|
dst=router_interface_port['port']['mac_address'],
|
||||||
ethertype=ryu.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
ethertype=os_ken.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
||||||
)
|
)
|
||||||
ip = ryu.lib.packet.ipv4.ipv4(
|
ip = os_ken.lib.packet.ipv4.ipv4(
|
||||||
src=str(self.port1.port.get_logical_port().ip),
|
src=str(self.port1.port.get_logical_port().ip),
|
||||||
dst=str(dst_ip),
|
dst=str(dst_ip),
|
||||||
ttl=ttl,
|
ttl=ttl,
|
||||||
proto=proto,
|
proto=proto,
|
||||||
)
|
)
|
||||||
if proto == ryu.lib.packet.ipv4.inet.IPPROTO_ICMP:
|
if proto == os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP:
|
||||||
ip_data = ryu.lib.packet.icmp.icmp(
|
ip_data = os_ken.lib.packet.icmp.icmp(
|
||||||
type_=ryu.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
type_=os_ken.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
||||||
data=ryu.lib.packet.icmp.echo(
|
data=os_ken.lib.packet.icmp.echo(
|
||||||
data=self._create_random_string())
|
data=self._create_random_string())
|
||||||
)
|
)
|
||||||
self._ping = ip_data
|
self._ping = ip_data
|
||||||
elif proto == ryu.lib.packet.ipv4.inet.IPPROTO_UDP:
|
elif proto == os_ken.lib.packet.ipv4.inet.IPPROTO_UDP:
|
||||||
ip_data = ryu.lib.packet.udp.udp(
|
ip_data = os_ken.lib.packet.udp.udp(
|
||||||
dst_port=33534,
|
dst_port=33534,
|
||||||
)
|
)
|
||||||
self._ip = ip
|
self._ip = ip
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ethernet)
|
result.add_protocol(ethernet)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
result.add_protocol(ip_data)
|
result.add_protocol(ip_data)
|
||||||
|
@ -177,10 +177,10 @@ class TestL3App(test_base.DFTestBase):
|
||||||
return self._ip
|
return self._ip
|
||||||
|
|
||||||
def _create_pong_packet(self, buf):
|
def _create_pong_packet(self, buf):
|
||||||
pkt = ryu.lib.packet.packet.Packet(buf)
|
pkt = os_ken.lib.packet.packet.Packet(buf)
|
||||||
ether = pkt.get_protocol(ryu.lib.packet.ethernet.ethernet)
|
ether = pkt.get_protocol(os_ken.lib.packet.ethernet.ethernet)
|
||||||
ip = pkt.get_protocol(ryu.lib.packet.ipv4.ipv4)
|
ip = pkt.get_protocol(os_ken.lib.packet.ipv4.ipv4)
|
||||||
icmp = pkt.get_protocol(ryu.lib.packet.icmp.icmp)
|
icmp = pkt.get_protocol(os_ken.lib.packet.icmp.icmp)
|
||||||
|
|
||||||
ether.src, ether.dst = ether.dst, ether.src
|
ether.src, ether.dst = ether.dst, ether.src
|
||||||
|
|
||||||
|
@ -215,9 +215,9 @@ class TestL3App(test_base.DFTestBase):
|
||||||
self.port1.port.get_logical_port().ip
|
self.port1.port.get_logical_port().ip
|
||||||
)
|
)
|
||||||
|
|
||||||
icmp.type = ryu.lib.packet.icmp.ICMP_ECHO_REPLY
|
icmp.type = os_ken.lib.packet.icmp.ICMP_ECHO_REPLY
|
||||||
icmp.csum = 0
|
icmp.csum = 0
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ether)
|
result.add_protocol(ether)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
result.add_protocol(icmp)
|
result.add_protocol(icmp)
|
||||||
|
@ -227,7 +227,7 @@ class TestL3App(test_base.DFTestBase):
|
||||||
def _test_icmp_address(self, dst_ip):
|
def _test_icmp_address(self, dst_ip):
|
||||||
port_policies = self._create_port_policies()
|
port_policies = self._create_port_policies()
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
dst_ip, ryu.lib.packet.ipv4.inet.IPPROTO_ICMP)
|
dst_ip, os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP)
|
||||||
policy = app_testing_objects.Policy(
|
policy = app_testing_objects.Policy(
|
||||||
initial_actions=[
|
initial_actions=[
|
||||||
app_testing_objects.SendAction(
|
app_testing_objects.SendAction(
|
||||||
|
@ -288,7 +288,7 @@ class TestL3App(test_base.DFTestBase):
|
||||||
dst_ip = self.port2.port.get_logical_port().ip
|
dst_ip = self.port2.port.get_logical_port().ip
|
||||||
port_policies = self._create_port_policies(connected=False)
|
port_policies = self._create_port_policies(connected=False)
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
dst_ip, ryu.lib.packet.ipv4.inet.IPPROTO_ICMP)
|
dst_ip, os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP)
|
||||||
policy = app_testing_objects.Policy(
|
policy = app_testing_objects.Policy(
|
||||||
initial_actions=[
|
initial_actions=[
|
||||||
app_testing_objects.SendAction(
|
app_testing_objects.SendAction(
|
||||||
|
@ -330,14 +330,14 @@ class TestL3App(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -367,12 +367,12 @@ class TestL3App(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[ignore_action]
|
actions=[ignore_action]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[ignore_action]
|
actions=[ignore_action]
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -386,10 +386,10 @@ class TestL3App(test_base.DFTestBase):
|
||||||
ignore_action = app_testing_objects.IgnoreAction()
|
ignore_action = app_testing_objects.IgnoreAction()
|
||||||
port_policy = self._create_rate_limit_port_policies(
|
port_policy = self._create_rate_limit_port_policies(
|
||||||
cfg.CONF.df_l3_app.router_ttl_invalid_max_rate,
|
cfg.CONF.df_l3_app.router_ttl_invalid_max_rate,
|
||||||
app_testing_objects.RyuICMPTimeExceedFilter)
|
app_testing_objects.OsKenICMPTimeExceedFilter)
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
self.port2.port.get_logical_port().ip,
|
self.port2.port.get_logical_port().ip,
|
||||||
ryu.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
||||||
ttl=1)
|
ttl=1)
|
||||||
send_action = app_testing_objects.SendAction(
|
send_action = app_testing_objects.SendAction(
|
||||||
self.subnet1.subnet_id,
|
self.subnet1.subnet_id,
|
||||||
|
@ -423,9 +423,9 @@ class TestL3App(test_base.DFTestBase):
|
||||||
self.port1.port.update({"security_groups": []})
|
self.port1.port.update({"security_groups": []})
|
||||||
ignore_action = app_testing_objects.IgnoreAction()
|
ignore_action = app_testing_objects.IgnoreAction()
|
||||||
port_policy = self._create_icmp_test_port_policies(
|
port_policy = self._create_icmp_test_port_policies(
|
||||||
app_testing_objects.RyuICMPUnreachFilter)
|
app_testing_objects.OsKenICMPUnreachFilter)
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
"192.168.12.1", ryu.lib.packet.ipv4.inet.IPPROTO_UDP)
|
"192.168.12.1", os_ken.lib.packet.ipv4.inet.IPPROTO_UDP)
|
||||||
policy = app_testing_objects.Policy(
|
policy = app_testing_objects.Policy(
|
||||||
initial_actions=[
|
initial_actions=[
|
||||||
app_testing_objects.SendAction(
|
app_testing_objects.SendAction(
|
||||||
|
@ -471,9 +471,9 @@ class TestL3App(test_base.DFTestBase):
|
||||||
ignore_action = app_testing_objects.IgnoreAction()
|
ignore_action = app_testing_objects.IgnoreAction()
|
||||||
port_policy = self._create_rate_limit_port_policies(
|
port_policy = self._create_rate_limit_port_policies(
|
||||||
cfg.CONF.df_l3_app.router_port_unreach_max_rate,
|
cfg.CONF.df_l3_app.router_port_unreach_max_rate,
|
||||||
app_testing_objects.RyuICMPUnreachFilter)
|
app_testing_objects.OsKenICMPUnreachFilter)
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
"192.168.12.1", ryu.lib.packet.ipv4.inet.IPPROTO_UDP)
|
"192.168.12.1", os_ken.lib.packet.ipv4.inet.IPPROTO_UDP)
|
||||||
send_action = app_testing_objects.SendAction(
|
send_action = app_testing_objects.SendAction(
|
||||||
self.subnet1.subnet_id,
|
self.subnet1.subnet_id,
|
||||||
self.port1.port_id,
|
self.port1.port_id,
|
||||||
|
@ -507,20 +507,20 @@ class TestL3App(test_base.DFTestBase):
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# The nexthop lport should get the icmp echo request whose
|
# The nexthop lport should get the icmp echo request whose
|
||||||
# destination is the cidr of extra route.
|
# destination is the cidr of extra route.
|
||||||
app_testing_objects.RyuICMPPingFilter(self._get_ping),
|
app_testing_objects.OsKenICMPPingFilter(self._get_ping),
|
||||||
actions=[app_testing_objects.DisableRuleAction(),
|
actions=[app_testing_objects.DisableRuleAction(),
|
||||||
app_testing_objects.StopSimulationAction()]
|
app_testing_objects.StopSimulationAction()]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -543,7 +543,7 @@ class TestL3App(test_base.DFTestBase):
|
||||||
port_policy = self._create_extra_route_policies(nexthop_port)
|
port_policy = self._create_extra_route_policies(nexthop_port)
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
"30.0.0.12",
|
"30.0.0.12",
|
||||||
ryu.lib.packet.ipv4.inet.IPPROTO_ICMP)
|
os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP)
|
||||||
send_action = app_testing_objects.SendAction(
|
send_action = app_testing_objects.SendAction(
|
||||||
self.subnet1.subnet_id,
|
self.subnet1.subnet_id,
|
||||||
self.port1.port_id,
|
self.port1.port_id,
|
||||||
|
|
|
@ -14,8 +14,8 @@ import netaddr
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
import os_ken.lib.packet
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import ryu.lib.packet
|
|
||||||
|
|
||||||
from dragonflow.tests.common import app_testing_objects
|
from dragonflow.tests.common import app_testing_objects
|
||||||
from dragonflow.tests.common import constants as const
|
from dragonflow.tests.common import constants as const
|
||||||
|
@ -120,17 +120,17 @@ class TestPortSecApp(test_base.DFTestBase):
|
||||||
self.icmp_id_cursor += 1
|
self.icmp_id_cursor += 1
|
||||||
icmp_seq = 0
|
icmp_seq = 0
|
||||||
if self.ethertype == n_const.IPv4:
|
if self.ethertype == n_const.IPv4:
|
||||||
icmp = ryu.lib.packet.icmp.icmp(
|
icmp = os_ken.lib.packet.icmp.icmp(
|
||||||
type_=ryu.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
type_=os_ken.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
||||||
data=ryu.lib.packet.icmp.echo(
|
data=os_ken.lib.packet.icmp.echo(
|
||||||
id_=icmp_id,
|
id_=icmp_id,
|
||||||
seq=icmp_seq,
|
seq=icmp_seq,
|
||||||
data=self._create_random_string())
|
data=self._create_random_string())
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
icmp = ryu.lib.packet.icmpv6.icmpv6(
|
icmp = os_ken.lib.packet.icmpv6.icmpv6(
|
||||||
type_=ryu.lib.packet.icmpv6.ICMPV6_ECHO_REQUEST,
|
type_=os_ken.lib.packet.icmpv6.ICMPV6_ECHO_REQUEST,
|
||||||
data=ryu.lib.packet.icmpv6.echo(
|
data=os_ken.lib.packet.icmpv6.echo(
|
||||||
id_=icmp_id,
|
id_=icmp_id,
|
||||||
seq=icmp_seq,
|
seq=icmp_seq,
|
||||||
data=self._create_random_string())
|
data=self._create_random_string())
|
||||||
|
@ -139,21 +139,21 @@ class TestPortSecApp(test_base.DFTestBase):
|
||||||
|
|
||||||
def _get_packet_protocol(self, src_ip, dst_ip):
|
def _get_packet_protocol(self, src_ip, dst_ip):
|
||||||
if self.ethertype == n_const.IPv4:
|
if self.ethertype == n_const.IPv4:
|
||||||
ip = ryu.lib.packet.ipv4.ipv4(
|
ip = os_ken.lib.packet.ipv4.ipv4(
|
||||||
src=str(src_ip),
|
src=str(src_ip),
|
||||||
dst=str(dst_ip),
|
dst=str(dst_ip),
|
||||||
proto=ryu.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
proto=os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
ip = ryu.lib.packet.ipv6.ipv6(
|
ip = os_ken.lib.packet.ipv6.ipv6(
|
||||||
src=str(src_ip),
|
src=str(src_ip),
|
||||||
dst=str(dst_ip),
|
dst=str(dst_ip),
|
||||||
nxt=ryu.lib.packet.ipv6.inet.IPPROTO_ICMPV6)
|
nxt=os_ken.lib.packet.ipv6.inet.IPPROTO_ICMPV6)
|
||||||
|
|
||||||
return ip
|
return ip
|
||||||
|
|
||||||
def _create_ping_request(self, src_ip, src_mac, dst_port):
|
def _create_ping_request(self, src_ip, src_mac, dst_port):
|
||||||
ethernet = ryu.lib.packet.ethernet.ethernet(
|
ethernet = os_ken.lib.packet.ethernet.ethernet(
|
||||||
src=str(src_mac),
|
src=str(src_mac),
|
||||||
dst=str(dst_port.port.get_logical_port().mac),
|
dst=str(dst_port.port.get_logical_port().mac),
|
||||||
ethertype=self.ethtype
|
ethertype=self.ethtype
|
||||||
|
@ -163,7 +163,7 @@ class TestPortSecApp(test_base.DFTestBase):
|
||||||
src_ip,
|
src_ip,
|
||||||
dst_port.port.get_logical_port().ip)
|
dst_port.port.get_logical_port().ip)
|
||||||
icmp = self._get_icmp_packet()
|
icmp = self._get_icmp_packet()
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ethernet)
|
result.add_protocol(ethernet)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
result.add_protocol(icmp)
|
result.add_protocol(icmp)
|
||||||
|
@ -175,14 +175,14 @@ class TestPortSecApp(test_base.DFTestBase):
|
||||||
rules = [
|
rules = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -200,7 +200,7 @@ class TestPortSecApp(test_base.DFTestBase):
|
||||||
)
|
)
|
||||||
rules = [
|
rules = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
app_testing_objects.RyuICMPPingFilter(
|
app_testing_objects.OsKenICMPPingFilter(
|
||||||
self._get_ping_using_vm_ip_mac, self.ethertype),
|
self._get_ping_using_vm_ip_mac, self.ethertype),
|
||||||
actions=[
|
actions=[
|
||||||
count_action,
|
count_action,
|
||||||
|
@ -208,7 +208,7 @@ class TestPortSecApp(test_base.DFTestBase):
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
app_testing_objects.RyuICMPPingFilter(
|
app_testing_objects.OsKenICMPPingFilter(
|
||||||
self._get_ping_using_allowed_address_pair_ip_mac,
|
self._get_ping_using_allowed_address_pair_ip_mac,
|
||||||
self.ethertype),
|
self.ethertype),
|
||||||
actions=[
|
actions=[
|
||||||
|
@ -217,7 +217,7 @@ class TestPortSecApp(test_base.DFTestBase):
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
app_testing_objects.RyuICMPPingFilter(
|
app_testing_objects.OsKenICMPPingFilter(
|
||||||
self._get_ping_using_fake_ip, self.ethertype),
|
self._get_ping_using_fake_ip, self.ethertype),
|
||||||
actions=[
|
actions=[
|
||||||
app_testing_objects.RaiseAction("a packet with a fake "
|
app_testing_objects.RaiseAction("a packet with a fake "
|
||||||
|
@ -225,7 +225,7 @@ class TestPortSecApp(test_base.DFTestBase):
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
app_testing_objects.RyuICMPPingFilter(
|
app_testing_objects.OsKenICMPPingFilter(
|
||||||
self._get_ping_using_fake_mac, self.ethertype),
|
self._get_ping_using_fake_mac, self.ethertype),
|
||||||
actions=[
|
actions=[
|
||||||
app_testing_objects.RaiseAction("a packet with a fake "
|
app_testing_objects.RaiseAction("a packet with a fake "
|
||||||
|
@ -297,7 +297,7 @@ class TestPortSecAppV4(TestPortSecApp):
|
||||||
self.cidr = "192.168.196.0/24"
|
self.cidr = "192.168.196.0/24"
|
||||||
self.ethertype = n_const.IPv4
|
self.ethertype = n_const.IPv4
|
||||||
self.icmp_proto = "icmp"
|
self.icmp_proto = "icmp"
|
||||||
self.ethtype = ryu.lib.packet.ethernet.ether.ETH_TYPE_IP
|
self.ethtype = os_ken.lib.packet.ethernet.ether.ETH_TYPE_IP
|
||||||
super(TestPortSecAppV4, self).setUp()
|
super(TestPortSecAppV4, self).setUp()
|
||||||
|
|
||||||
def test_icmp_ping_using_different_ip_mac(self):
|
def test_icmp_ping_using_different_ip_mac(self):
|
||||||
|
@ -313,7 +313,7 @@ class TestPortSecAppV6(TestPortSecApp):
|
||||||
self.icmp_id_cursor = int(time.mktime(time.gmtime())) & 0xffff
|
self.icmp_id_cursor = int(time.mktime(time.gmtime())) & 0xffff
|
||||||
self.cidr = "fda8:06c3:ce53:a890::1/32"
|
self.cidr = "fda8:06c3:ce53:a890::1/32"
|
||||||
self.ethertype = n_const.IPv6
|
self.ethertype = n_const.IPv6
|
||||||
self.ethtype = ryu.lib.packet.ethernet.ether.ETH_TYPE_IPV6
|
self.ethtype = os_ken.lib.packet.ethernet.ether.ETH_TYPE_IPV6
|
||||||
self.icmp_proto = "icmpv6"
|
self.icmp_proto = "icmpv6"
|
||||||
super(TestPortSecAppV6, self).setUp()
|
super(TestPortSecAppV6, self).setUp()
|
||||||
|
|
||||||
|
@ -322,35 +322,35 @@ class TestPortSecAppV6(TestPortSecApp):
|
||||||
rules = [
|
rules = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore Neighbor Advertisements
|
# Ignore Neighbor Advertisements
|
||||||
app_testing_objects.RyuNeighborSolicitationFilter(),
|
app_testing_objects.OsKenNeighborSolicitationFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore Neighbor Advertisements
|
# Ignore Neighbor Advertisements
|
||||||
app_testing_objects.RyuNeighborAdvertisementFilter(),
|
app_testing_objects.OsKenNeighborAdvertisementFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore Neighbor Advertisements
|
# Ignore Neighbor Advertisements
|
||||||
app_testing_objects.RyuRouterSolicitationFilter(),
|
app_testing_objects.OsKenRouterSolicitationFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 multicast
|
# Ignore IPv6 multicast
|
||||||
app_testing_objects.RyuIpv6MulticastFilter(),
|
app_testing_objects.OsKenIpv6MulticastFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
|
|
@ -14,8 +14,8 @@ import netaddr
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
import os_ken.lib.packet
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import ryu.lib.packet
|
|
||||||
|
|
||||||
from dragonflow.tests.common import app_testing_objects
|
from dragonflow.tests.common import app_testing_objects
|
||||||
from dragonflow.tests.common import constants as const
|
from dragonflow.tests.common import constants as const
|
||||||
|
@ -182,14 +182,14 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
rules = [
|
rules = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -203,7 +203,7 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
rules1 = [
|
rules1 = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect pong, end simulation
|
# Detect pong, end simulation
|
||||||
app_testing_objects.RyuICMPPongFilter(
|
app_testing_objects.OsKenICMPPongFilter(
|
||||||
self.permit_icmp_request, ethertype=self.ethertype),
|
self.permit_icmp_request, ethertype=self.ethertype),
|
||||||
actions=[
|
actions=[
|
||||||
app_testing_objects.DisableRuleAction(),
|
app_testing_objects.DisableRuleAction(),
|
||||||
|
@ -215,7 +215,7 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
rules2 = [
|
rules2 = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect pong, raise unexpected packet exception
|
# Detect pong, raise unexpected packet exception
|
||||||
app_testing_objects.RyuICMPPongFilter(
|
app_testing_objects.OsKenICMPPongFilter(
|
||||||
self.no_permit_icmp_request,
|
self.no_permit_icmp_request,
|
||||||
self.ethertype),
|
self.ethertype),
|
||||||
actions=[
|
actions=[
|
||||||
|
@ -227,7 +227,7 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
rules3 = [
|
rules3 = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect ping from port1, reply with pong
|
# Detect ping from port1, reply with pong
|
||||||
app_testing_objects.RyuICMPPingFilter(
|
app_testing_objects.OsKenICMPPingFilter(
|
||||||
self.permit_icmp_request,
|
self.permit_icmp_request,
|
||||||
self.ethertype),
|
self.ethertype),
|
||||||
actions=[
|
actions=[
|
||||||
|
@ -241,7 +241,7 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect ping from port2, raise unexpected packet exception
|
# Detect ping from port2, raise unexpected packet exception
|
||||||
app_testing_objects.RyuICMPPingFilter(
|
app_testing_objects.OsKenICMPPingFilter(
|
||||||
self.no_permit_icmp_request,
|
self.no_permit_icmp_request,
|
||||||
self.ethertype),
|
self.ethertype),
|
||||||
actions=[
|
actions=[
|
||||||
|
@ -278,7 +278,7 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
rules = [
|
rules = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect ping from port4, end the test
|
# Detect ping from port4, end the test
|
||||||
app_testing_objects.RyuICMPPingFilter(
|
app_testing_objects.OsKenICMPPingFilter(
|
||||||
self._get_allowed_address_pairs_icmp_request,
|
self._get_allowed_address_pairs_icmp_request,
|
||||||
self.ethertype),
|
self.ethertype),
|
||||||
actions=[
|
actions=[
|
||||||
|
@ -299,13 +299,13 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
|
|
||||||
def _create_packet_protocol(self, src_ip, dst_ip):
|
def _create_packet_protocol(self, src_ip, dst_ip):
|
||||||
if self.ethertype == n_const.IPv4:
|
if self.ethertype == n_const.IPv4:
|
||||||
ip = ryu.lib.packet.ipv4.ipv4(
|
ip = os_ken.lib.packet.ipv4.ipv4(
|
||||||
src=str(src_ip),
|
src=str(src_ip),
|
||||||
dst=str(dst_ip),
|
dst=str(dst_ip),
|
||||||
proto=self.icmp_type
|
proto=self.icmp_type
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
ip = ryu.lib.packet.ipv6.ipv6(
|
ip = os_ken.lib.packet.ipv6.ipv6(
|
||||||
src=str(src_ip),
|
src=str(src_ip),
|
||||||
dst=str(dst_ip),
|
dst=str(dst_ip),
|
||||||
nxt=self.icmp_type)
|
nxt=self.icmp_type)
|
||||||
|
@ -314,7 +314,7 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
def _create_ping_packet(self, src_port, dst_port):
|
def _create_ping_packet(self, src_port, dst_port):
|
||||||
src_mac, src_ip = apps.get_port_mac_and_ip(src_port)
|
src_mac, src_ip = apps.get_port_mac_and_ip(src_port)
|
||||||
|
|
||||||
ethernet = ryu.lib.packet.ethernet.ethernet(
|
ethernet = os_ken.lib.packet.ethernet.ethernet(
|
||||||
src=str(src_mac),
|
src=str(src_mac),
|
||||||
dst=str(dst_port.port.get_logical_port().mac),
|
dst=str(dst_port.port.get_logical_port().mac),
|
||||||
ethertype=self.ethtype,
|
ethertype=self.ethtype,
|
||||||
|
@ -330,7 +330,7 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
seq=icmp_seq,
|
seq=icmp_seq,
|
||||||
data=self._create_random_string())
|
data=self._create_random_string())
|
||||||
)
|
)
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ethernet)
|
result.add_protocol(ethernet)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
result.add_protocol(icmp)
|
result.add_protocol(icmp)
|
||||||
|
@ -338,8 +338,8 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
return result, icmp
|
return result, icmp
|
||||||
|
|
||||||
def _create_pong_packet(self, buf):
|
def _create_pong_packet(self, buf):
|
||||||
pkt = ryu.lib.packet.packet.Packet(buf)
|
pkt = os_ken.lib.packet.packet.Packet(buf)
|
||||||
ether = pkt.get_protocol(ryu.lib.packet.ethernet.ethernet)
|
ether = pkt.get_protocol(os_ken.lib.packet.ethernet.ethernet)
|
||||||
ip = pkt.get_protocol(self.ip_class)
|
ip = pkt.get_protocol(self.ip_class)
|
||||||
icmp = pkt.get_protocol(self.icmp_class)
|
icmp = pkt.get_protocol(self.icmp_class)
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ class TestSGApp(test_base.DFTestBase):
|
||||||
else:
|
else:
|
||||||
icmp.type_ = self.icmp_echo_reply
|
icmp.type_ = self.icmp_echo_reply
|
||||||
icmp.csum = 0
|
icmp.csum = 0
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ether)
|
result.add_protocol(ether)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
result.add_protocol(icmp)
|
result.add_protocol(icmp)
|
||||||
|
@ -458,13 +458,13 @@ class TestSGAppIpv4(TestSGApp):
|
||||||
self.permit_port = self.port1
|
self.permit_port = self.port1
|
||||||
self.no_permit_port = self.port2
|
self.no_permit_port = self.port2
|
||||||
|
|
||||||
self.ip_class = ryu.lib.packet.ipv4.ipv4
|
self.ip_class = os_ken.lib.packet.ipv4.ipv4
|
||||||
self.icmp_class = ryu.lib.packet.icmp.icmp
|
self.icmp_class = os_ken.lib.packet.icmp.icmp
|
||||||
self.icmp_echo_class = ryu.lib.packet.icmp.echo
|
self.icmp_echo_class = os_ken.lib.packet.icmp.echo
|
||||||
self.icmp_type = ryu.lib.packet.ipv4.inet.IPPROTO_ICMP
|
self.icmp_type = os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP
|
||||||
self.icmp_echo_request = ryu.lib.packet.icmp.ICMP_ECHO_REQUEST
|
self.icmp_echo_request = os_ken.lib.packet.icmp.ICMP_ECHO_REQUEST
|
||||||
self.icmp_echo_reply = ryu.lib.packet.icmp.ICMP_ECHO_REPLY
|
self.icmp_echo_reply = os_ken.lib.packet.icmp.ICMP_ECHO_REPLY
|
||||||
self.ethtype = ryu.lib.packet.ethernet.ether.ETH_TYPE_IP
|
self.ethtype = os_ken.lib.packet.ethernet.ether.ETH_TYPE_IP
|
||||||
|
|
||||||
time.sleep(const.DEFAULT_RESOURCE_READY_TIMEOUT)
|
time.sleep(const.DEFAULT_RESOURCE_READY_TIMEOUT)
|
||||||
|
|
||||||
|
@ -494,13 +494,14 @@ class TestSGAppIpv6(TestSGApp):
|
||||||
self.permit_port = self.port1
|
self.permit_port = self.port1
|
||||||
self.no_permit_port = self.port2
|
self.no_permit_port = self.port2
|
||||||
|
|
||||||
self.ip_class = ryu.lib.packet.ipv6.ipv6
|
self.ip_class = os_ken.lib.packet.ipv6.ipv6
|
||||||
self.icmp_class = ryu.lib.packet.icmpv6.icmpv6
|
self.icmp_class = os_ken.lib.packet.icmpv6.icmpv6
|
||||||
self.icmp_echo_class = ryu.lib.packet.icmpv6.echo
|
self.icmp_echo_class = os_ken.lib.packet.icmpv6.echo
|
||||||
self.icmp_type = ryu.lib.packet.ipv6.inet.IPPROTO_ICMPV6
|
self.icmp_type = os_ken.lib.packet.ipv6.inet.IPPROTO_ICMPV6
|
||||||
self.icmp_echo_request = ryu.lib.packet.icmpv6.ICMPV6_ECHO_REQUEST
|
self.icmp_echo_request = (
|
||||||
self.icmp_echo_reply = ryu.lib.packet.icmpv6.ICMPV6_ECHO_REPLY
|
os_ken.lib.packet.icmpv6.ICMPV6_ECHO_REQUEST)
|
||||||
self.ethtype = ryu.lib.packet.ethernet.ether.ETH_TYPE_IPV6
|
self.icmp_echo_reply = os_ken.lib.packet.icmpv6.ICMPV6_ECHO_REPLY
|
||||||
|
self.ethtype = os_ken.lib.packet.ethernet.ether.ETH_TYPE_IPV6
|
||||||
time.sleep(const.DEFAULT_RESOURCE_READY_TIMEOUT)
|
time.sleep(const.DEFAULT_RESOURCE_READY_TIMEOUT)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -513,35 +514,35 @@ class TestSGAppIpv6(TestSGApp):
|
||||||
rules = [
|
rules = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore Neighbor Advertisements
|
# Ignore Neighbor Advertisements
|
||||||
app_testing_objects.RyuNeighborSolicitationFilter(),
|
app_testing_objects.OsKenNeighborSolicitationFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore Neighbor Advertisements
|
# Ignore Neighbor Advertisements
|
||||||
app_testing_objects.RyuNeighborAdvertisementFilter(),
|
app_testing_objects.OsKenNeighborAdvertisementFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore Neighbor Advertisements
|
# Ignore Neighbor Advertisements
|
||||||
app_testing_objects.RyuRouterSolicitationFilter(),
|
app_testing_objects.OsKenRouterSolicitationFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 multicast
|
# Ignore IPv6 multicast
|
||||||
app_testing_objects.RyuIpv6MulticastFilter(),
|
app_testing_objects.OsKenIpv6MulticastFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
|
|
@ -14,8 +14,8 @@ import time
|
||||||
|
|
||||||
from neutron.agent.common import ip_lib
|
from neutron.agent.common import ip_lib
|
||||||
from neutron.conf.agent import common as n_common
|
from neutron.conf.agent import common as n_common
|
||||||
|
import os_ken.lib.packet
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import ryu.lib.packet
|
|
||||||
|
|
||||||
from dragonflow.tests.common import app_testing_objects
|
from dragonflow.tests.common import app_testing_objects
|
||||||
from dragonflow.tests.common import constants as const
|
from dragonflow.tests.common import constants as const
|
||||||
|
@ -72,7 +72,7 @@ class TestSNat(test_base.DFTestBase):
|
||||||
def _create_policy(self):
|
def _create_policy(self):
|
||||||
port_policies = self._create_port_policies()
|
port_policies = self._create_port_policies()
|
||||||
initial_packet = self._create_packet(
|
initial_packet = self._create_packet(
|
||||||
'10.0.1.2', ryu.lib.packet.ipv4.inet.IPPROTO_ICMP)
|
'10.0.1.2', os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP)
|
||||||
policy = app_testing_objects.Policy(
|
policy = app_testing_objects.Policy(
|
||||||
initial_actions=[
|
initial_actions=[
|
||||||
app_testing_objects.SendAction(self.subnet1.subnet_id,
|
app_testing_objects.SendAction(self.subnet1.subnet_id,
|
||||||
|
@ -94,19 +94,19 @@ class TestSNat(test_base.DFTestBase):
|
||||||
rules1 = [
|
rules1 = [
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect pong, end simulation
|
# Detect pong, end simulation
|
||||||
app_testing_objects.RyuICMPPongFilter(self._get_ping),
|
app_testing_objects.OsKenICMPPongFilter(self._get_ping),
|
||||||
actions=actions
|
actions=actions
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -127,25 +127,25 @@ class TestSNat(test_base.DFTestBase):
|
||||||
router_interface_port = self.neutron.show_port(
|
router_interface_port = self.neutron.show_port(
|
||||||
router_interface['port_id']
|
router_interface['port_id']
|
||||||
)
|
)
|
||||||
ethernet = ryu.lib.packet.ethernet.ethernet(
|
ethernet = os_ken.lib.packet.ethernet.ethernet(
|
||||||
src=self.port1.port.get_logical_port().mac,
|
src=self.port1.port.get_logical_port().mac,
|
||||||
dst=router_interface_port['port']['mac_address'],
|
dst=router_interface_port['port']['mac_address'],
|
||||||
ethertype=ryu.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
ethertype=os_ken.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
||||||
)
|
)
|
||||||
ip = ryu.lib.packet.ipv4.ipv4(
|
ip = os_ken.lib.packet.ipv4.ipv4(
|
||||||
src=self.port1.port.get_logical_port().ip,
|
src=self.port1.port.get_logical_port().ip,
|
||||||
dst=dst_ip,
|
dst=dst_ip,
|
||||||
ttl=ttl,
|
ttl=ttl,
|
||||||
proto=proto,
|
proto=proto,
|
||||||
)
|
)
|
||||||
ip_data = ryu.lib.packet.icmp.icmp(
|
ip_data = os_ken.lib.packet.icmp.icmp(
|
||||||
type_=ryu.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
type_=os_ken.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
||||||
data=ryu.lib.packet.icmp.echo(
|
data=os_ken.lib.packet.icmp.echo(
|
||||||
data=self._create_random_string())
|
data=self._create_random_string())
|
||||||
)
|
)
|
||||||
self._ping = ip_data
|
self._ping = ip_data
|
||||||
self._ip = ip
|
self._ip = ip
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ethernet)
|
result.add_protocol(ethernet)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
result.add_protocol(ip_data)
|
result.add_protocol(ip_data)
|
||||||
|
|
|
@ -14,8 +14,8 @@ import netaddr
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
import os_ken.lib.packet
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import ryu.lib.packet
|
|
||||||
|
|
||||||
from dragonflow.tests.common import app_testing_objects
|
from dragonflow.tests.common import app_testing_objects
|
||||||
from dragonflow.tests.common import constants as const
|
from dragonflow.tests.common import constants as const
|
||||||
|
@ -74,21 +74,22 @@ class TestTrunkApp(test_base.DFTestBase):
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect pong, end simulation
|
# Detect pong, end simulation
|
||||||
app_testing_objects.AndingFilter(
|
app_testing_objects.AndingFilter(
|
||||||
app_testing_objects.RyuVLANTagFilter(7),
|
app_testing_objects.OsKenVLANTagFilter(7),
|
||||||
app_testing_objects.RyuICMPPongFilter(self._get_ping)),
|
app_testing_objects.OsKenICMPPongFilter(
|
||||||
|
self._get_ping)),
|
||||||
actions=[app_testing_objects.DisableRuleAction(),
|
actions=[app_testing_objects.DisableRuleAction(),
|
||||||
app_testing_objects.StopSimulationAction()]
|
app_testing_objects.StopSimulationAction()]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -99,8 +100,8 @@ class TestTrunkApp(test_base.DFTestBase):
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Detect ping, reply with pong
|
# Detect ping, reply with pong
|
||||||
app_testing_objects.AndingFilter(
|
app_testing_objects.AndingFilter(
|
||||||
app_testing_objects.RyuVLANTagFilter(8),
|
app_testing_objects.OsKenVLANTagFilter(8),
|
||||||
app_testing_objects.RyuICMPPingFilter()),
|
app_testing_objects.OsKenICMPPingFilter()),
|
||||||
actions=[app_testing_objects.SendAction(
|
actions=[app_testing_objects.SendAction(
|
||||||
self.subnet1.subnet_id,
|
self.subnet1.subnet_id,
|
||||||
self.port2.port_id,
|
self.port2.port_id,
|
||||||
|
@ -109,14 +110,14 @@ class TestTrunkApp(test_base.DFTestBase):
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore gratuitous ARP packets
|
# Ignore gratuitous ARP packets
|
||||||
app_testing_objects.RyuARPGratuitousFilter(),
|
app_testing_objects.OsKenARPGratuitousFilter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
app_testing_objects.PortPolicyRule(
|
app_testing_objects.PortPolicyRule(
|
||||||
# Ignore IPv6 packets
|
# Ignore IPv6 packets
|
||||||
app_testing_objects.RyuIPv6Filter(),
|
app_testing_objects.OsKenIPv6Filter(),
|
||||||
actions=[
|
actions=[
|
||||||
ignore_action
|
ignore_action
|
||||||
]
|
]
|
||||||
|
@ -165,28 +166,28 @@ class TestTrunkApp(test_base.DFTestBase):
|
||||||
return self._ping
|
return self._ping
|
||||||
|
|
||||||
def _create_ping_packet(self, ttl=255):
|
def _create_ping_packet(self, ttl=255):
|
||||||
ethernet = ryu.lib.packet.ethernet.ethernet(
|
ethernet = os_ken.lib.packet.ethernet.ethernet(
|
||||||
src=self.vlan_port1.get_logical_port().mac,
|
src=self.vlan_port1.get_logical_port().mac,
|
||||||
dst=self.vlan_port2.get_logical_port().mac,
|
dst=self.vlan_port2.get_logical_port().mac,
|
||||||
ethertype=ryu.lib.packet.ethernet.ether.ETH_TYPE_8021Q,
|
ethertype=os_ken.lib.packet.ethernet.ether.ETH_TYPE_8021Q,
|
||||||
)
|
)
|
||||||
vlan = ryu.lib.packet.vlan.vlan(
|
vlan = os_ken.lib.packet.vlan.vlan(
|
||||||
vid=7,
|
vid=7,
|
||||||
ethertype=ryu.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
ethertype=os_ken.lib.packet.ethernet.ether.ETH_TYPE_IP,
|
||||||
)
|
)
|
||||||
ip = ryu.lib.packet.ipv4.ipv4(
|
ip = os_ken.lib.packet.ipv4.ipv4(
|
||||||
src=str(self.vlan_port1.get_logical_port().ip),
|
src=str(self.vlan_port1.get_logical_port().ip),
|
||||||
dst=str(self.vlan_port2.get_logical_port().ip),
|
dst=str(self.vlan_port2.get_logical_port().ip),
|
||||||
ttl=ttl,
|
ttl=ttl,
|
||||||
proto=ryu.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
proto=os_ken.lib.packet.ipv4.inet.IPPROTO_ICMP,
|
||||||
)
|
)
|
||||||
ip_data = ryu.lib.packet.icmp.icmp(
|
ip_data = os_ken.lib.packet.icmp.icmp(
|
||||||
type_=ryu.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
type_=os_ken.lib.packet.icmp.ICMP_ECHO_REQUEST,
|
||||||
data=ryu.lib.packet.icmp.echo(
|
data=os_ken.lib.packet.icmp.echo(
|
||||||
data=self._create_random_string())
|
data=self._create_random_string())
|
||||||
)
|
)
|
||||||
self._ping = ip_data
|
self._ping = ip_data
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ethernet)
|
result.add_protocol(ethernet)
|
||||||
result.add_protocol(vlan)
|
result.add_protocol(vlan)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
|
@ -195,11 +196,11 @@ class TestTrunkApp(test_base.DFTestBase):
|
||||||
return result.data
|
return result.data
|
||||||
|
|
||||||
def _create_pong_packet(self, buf):
|
def _create_pong_packet(self, buf):
|
||||||
pkt = ryu.lib.packet.packet.Packet(buf)
|
pkt = os_ken.lib.packet.packet.Packet(buf)
|
||||||
ether = pkt.get_protocol(ryu.lib.packet.ethernet.ethernet)
|
ether = pkt.get_protocol(os_ken.lib.packet.ethernet.ethernet)
|
||||||
vlan = pkt.get_protocol(ryu.lib.packet.vlan.vlan)
|
vlan = pkt.get_protocol(os_ken.lib.packet.vlan.vlan)
|
||||||
ip = pkt.get_protocol(ryu.lib.packet.ipv4.ipv4)
|
ip = pkt.get_protocol(os_ken.lib.packet.ipv4.ipv4)
|
||||||
icmp = pkt.get_protocol(ryu.lib.packet.icmp.icmp)
|
icmp = pkt.get_protocol(os_ken.lib.packet.icmp.icmp)
|
||||||
|
|
||||||
ether.src, ether.dst = ether.dst, ether.src
|
ether.src, ether.dst = ether.dst, ether.src
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -225,9 +226,9 @@ class TestTrunkApp(test_base.DFTestBase):
|
||||||
vlan.vid
|
vlan.vid
|
||||||
)
|
)
|
||||||
|
|
||||||
icmp.type = ryu.lib.packet.icmp.ICMP_ECHO_REPLY
|
icmp.type = os_ken.lib.packet.icmp.ICMP_ECHO_REPLY
|
||||||
icmp.csum = 0
|
icmp.csum = 0
|
||||||
result = ryu.lib.packet.packet.Packet()
|
result = os_ken.lib.packet.packet.Packet()
|
||||||
result.add_protocol(ether)
|
result.add_protocol(ether)
|
||||||
result.add_protocol(vlan)
|
result.add_protocol(vlan)
|
||||||
result.add_protocol(ip)
|
result.add_protocol(ip)
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from ryu.lib.packet import arp
|
from os_ken.lib.packet import arp
|
||||||
|
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
from dragonflow.tests.common import constants as test_const
|
from dragonflow.tests.common import constants as test_const
|
||||||
|
|
|
@ -290,7 +290,7 @@ class VMTestObj(object):
|
||||||
|
|
||||||
def create(self, network=None, script=None, security_groups=None,
|
def create(self, network=None, script=None, security_groups=None,
|
||||||
net_address=None):
|
net_address=None):
|
||||||
image = self.nova.glance.find_image("cirros-0.3.6-x86_64-disk")
|
image = self.nova.glance.find_image("cirros-0.4.0-x86_64-disk")
|
||||||
self.parent.assertIsNotNone(image)
|
self.parent.assertIsNotNone(image)
|
||||||
flavor = self.nova.flavors.find(name="m1.tiny")
|
flavor = self.nova.flavors.find(name="m1.tiny")
|
||||||
self.parent.assertIsNotNone(flavor)
|
self.parent.assertIsNotNone(flavor)
|
||||||
|
@ -352,7 +352,8 @@ class VMTestObj(object):
|
||||||
def close(self):
|
def close(self):
|
||||||
if self.closed or self.server is None:
|
if self.closed or self.server is None:
|
||||||
return
|
return
|
||||||
self.nova.servers.delete(self.server)
|
# No patience
|
||||||
|
self.nova.servers.force_delete(self.server)
|
||||||
self._wait_for_server_delete()
|
self._wait_for_server_delete()
|
||||||
self.closed = True
|
self.closed = True
|
||||||
|
|
||||||
|
|
|
@ -16,33 +16,34 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from ryu.base import app_manager
|
from os_ken.base import app_manager
|
||||||
from ryu import cfg as ryu_cfg
|
from os_ken import cfg as os_ken_cfg
|
||||||
|
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
from dragonflow.ovsdb import vswitch_impl
|
from dragonflow.ovsdb import vswitch_impl
|
||||||
from dragonflow.switch.drivers.ovs import ryu_base_app
|
from dragonflow.switch.drivers.ovs import os_ken_base_app
|
||||||
from dragonflow.tests.common import constants as const
|
from dragonflow.tests.common import constants as const
|
||||||
from dragonflow.tests.fullstack import test_base
|
from dragonflow.tests.fullstack import test_base
|
||||||
|
|
||||||
|
|
||||||
class TestRyuBaseApp(test_base.DFTestBase):
|
class TestOsKenBaseApp(test_base.DFTestBase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestRyuBaseApp, self).setUp()
|
super(TestOsKenBaseApp, self).setUp()
|
||||||
ryu_cfg.CONF(project='ryu', args=[])
|
os_ken_cfg.CONF(project='os_ken', args=[])
|
||||||
ryu_cfg.CONF.ofp_listen_host = cfg.CONF.df_ryu.of_listen_address
|
os_ken_cfg.CONF.ofp_listen_host = cfg.CONF.df_os_ken.of_listen_address
|
||||||
ryu_cfg.CONF.ofp_tcp_listen_port = cfg.CONF.df_ryu.of_listen_port + 1
|
os_ken_cfg.CONF.ofp_tcp_listen_port = (
|
||||||
|
cfg.CONF.df_os_ken.of_listen_port + 1)
|
||||||
app_mgr = app_manager.AppManager.get_instance()
|
app_mgr = app_manager.AppManager.get_instance()
|
||||||
self.open_flow_app = app_mgr.instantiate(
|
self.open_flow_app = app_mgr.instantiate(
|
||||||
ryu_base_app.RyuDFAdapter,
|
os_ken_base_app.OsKenDFAdapter,
|
||||||
switch_backend=mock.Mock(),
|
switch_backend=mock.Mock(),
|
||||||
nb_api=mock.Mock(),
|
nb_api=mock.Mock(),
|
||||||
db_change_callback=self._db_change_callback)
|
db_change_callback=self._db_change_callback)
|
||||||
self.open_flow_app.load = mock.Mock()
|
self.open_flow_app.load = mock.Mock()
|
||||||
self.addCleanup(app_mgr.uninstantiate, self.open_flow_app.name)
|
self.addCleanup(app_mgr.uninstantiate, self.open_flow_app.name)
|
||||||
|
|
||||||
test_controller = ('tcp:' + cfg.CONF.df_ryu.of_listen_address + ':' +
|
test_controller = ('tcp:' + cfg.CONF.df_os_ken.of_listen_address +
|
||||||
str(cfg.CONF.df_ryu.of_listen_port + 1))
|
':' + str(cfg.CONF.df_os_ken.of_listen_port + 1))
|
||||||
self.vswitch_api = vswitch_impl.OvsApi(self.mgt_ip)
|
self.vswitch_api = vswitch_impl.OvsApi(self.mgt_ip)
|
||||||
self.vswitch_api.initialize(self._db_change_callback)
|
self.vswitch_api.initialize(self._db_change_callback)
|
||||||
cur_controllers = self.vswitch_api.ovsdb.get_controller(
|
cur_controllers = self.vswitch_api.ovsdb.get_controller(
|
|
@ -14,16 +14,16 @@ import time
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from neutron_lib import constants
|
from neutron_lib import constants
|
||||||
|
from os_ken.lib.packet import ether_types
|
||||||
|
from os_ken.lib.packet import ethernet
|
||||||
|
from os_ken.lib.packet import in_proto as inet
|
||||||
|
from os_ken.lib.packet import ipv4
|
||||||
|
from os_ken.lib.packet import ipv6
|
||||||
|
from os_ken.lib.packet import mpls
|
||||||
|
from os_ken.lib.packet import packet
|
||||||
|
from os_ken.lib.packet import tcp
|
||||||
|
from os_ken.lib.packet import udp
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from ryu.lib.packet import ether_types
|
|
||||||
from ryu.lib.packet import ethernet
|
|
||||||
from ryu.lib.packet import in_proto as inet
|
|
||||||
from ryu.lib.packet import ipv4
|
|
||||||
from ryu.lib.packet import ipv6
|
|
||||||
from ryu.lib.packet import mpls
|
|
||||||
from ryu.lib.packet import packet
|
|
||||||
from ryu.lib.packet import tcp
|
|
||||||
from ryu.lib.packet import udp
|
|
||||||
import testscenarios
|
import testscenarios
|
||||||
|
|
||||||
from dragonflow.db.models import l2
|
from dragonflow.db.models import l2
|
||||||
|
@ -81,7 +81,7 @@ class SfcTestsCommonBase(test_base.DFTestBase):
|
||||||
return res[0], cls, res[2]
|
return res[0], cls, res[2]
|
||||||
|
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'ryu.lib.packet.mpls.mpls.parser', side_effect=parser,
|
'os_ken.lib.packet.mpls.mpls.parser', side_effect=parser,
|
||||||
):
|
):
|
||||||
pkt = packet.Packet(buf)
|
pkt = packet.Packet(buf)
|
||||||
if not isinstance(pkt.protocols[-1], mpls.mpls):
|
if not isinstance(pkt.protocols[-1], mpls.mpls):
|
||||||
|
@ -212,9 +212,9 @@ class SfcTestsCommonBase(test_base.DFTestBase):
|
||||||
def _create_port_policies(self, pc):
|
def _create_port_policies(self, pc):
|
||||||
res = {}
|
res = {}
|
||||||
if self.corr == sfc.CORR_MPLS:
|
if self.corr == sfc.CORR_MPLS:
|
||||||
sf_filter = app_testing_objects.RyuMplsFilter()
|
sf_filter = app_testing_objects.OsKenMplsFilter()
|
||||||
else:
|
else:
|
||||||
sf_filter = app_testing_objects.RyuUdpFilter(DST_PORT)
|
sf_filter = app_testing_objects.OsKenUdpFilter(DST_PORT)
|
||||||
|
|
||||||
for _, ppg in enumerate(pc.port_pair_groups):
|
for _, ppg in enumerate(pc.port_pair_groups):
|
||||||
for _, pp in enumerate(ppg.port_pairs):
|
for _, pp in enumerate(ppg.port_pairs):
|
||||||
|
|
|
@ -96,7 +96,5 @@ class TestSnatFlows(test_base.DFTestBase):
|
||||||
for key, value in r.items():
|
for key, value in r.items():
|
||||||
self.assertIsNotNone(value, key)
|
self.assertIsNotNone(value, key)
|
||||||
|
|
||||||
vm.server.stop()
|
|
||||||
vm.close()
|
vm.close()
|
||||||
network.close()
|
network.close()
|
||||||
return None
|
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from ryu.controller import ofp_event
|
from os_ken.controller import ofp_event
|
||||||
from ryu.lib.packet import ethernet
|
from os_ken.lib.packet import ethernet
|
||||||
from ryu.lib.packet import icmp
|
from os_ken.lib.packet import icmp
|
||||||
from ryu.lib.packet import in_proto
|
from os_ken.lib.packet import in_proto
|
||||||
from ryu.lib.packet import ipv4
|
from os_ken.lib.packet import ipv4
|
||||||
from ryu.lib.packet import packet
|
from os_ken.lib.packet import packet
|
||||||
from ryu.lib.packet import udp
|
from os_ken.lib.packet import udp
|
||||||
from ryu.ofproto import ofproto_v1_3_parser as ofproto_parser
|
from os_ken.ofproto import ofproto_v1_3_parser as ofproto_parser
|
||||||
|
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
from dragonflow.db.models import l2
|
from dragonflow.db.models import l2
|
||||||
|
|
|
@ -33,7 +33,7 @@ from dragonflow.db.models import l3
|
||||||
from dragonflow.db.models import secgroups
|
from dragonflow.db.models import secgroups
|
||||||
from dragonflow.db.models import switch
|
from dragonflow.db.models import switch
|
||||||
from dragonflow.switch.drivers.ovs import datapath
|
from dragonflow.switch.drivers.ovs import datapath
|
||||||
from dragonflow.switch.drivers.ovs import ryu_base_app
|
from dragonflow.switch.drivers.ovs import os_ken_base_app
|
||||||
from dragonflow.tests import base as tests_base
|
from dragonflow.tests import base as tests_base
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class DFAppTestBase(tests_base.BaseTestCase):
|
||||||
cfg.CONF.set_override('host', fake_chassis1.id)
|
cfg.CONF.set_override('host', fake_chassis1.id)
|
||||||
super(DFAppTestBase, self).setUp()
|
super(DFAppTestBase, self).setUp()
|
||||||
self.useFixture(log_fixture.SetLogLevel([None], logging.DEBUG))
|
self.useFixture(log_fixture.SetLogLevel([None], logging.DEBUG))
|
||||||
mock_app = mock.patch('ryu.base.app_manager.AppManager.get_instance'
|
mock_app = mock.patch('os_ken.base.app_manager.AppManager.get_instance'
|
||||||
).start()
|
).start()
|
||||||
self.addCleanup(mock_app.stop)
|
self.addCleanup(mock_app.stop)
|
||||||
mock_nb = mock.patch('dragonflow.db.api_nb.NbApi.get_instance')
|
mock_nb = mock.patch('dragonflow.db.api_nb.NbApi.get_instance')
|
||||||
|
@ -89,7 +89,7 @@ class DFAppTestBase(tests_base.BaseTestCase):
|
||||||
nb_api=self.controller.nb_api,
|
nb_api=self.controller.nb_api,
|
||||||
switch_backend=switch_backend
|
switch_backend=switch_backend
|
||||||
)
|
)
|
||||||
switch_backend.open_flow_app = ryu_base_app.RyuDFAdapter(
|
switch_backend.open_flow_app = os_ken_base_app.OsKenDFAdapter(
|
||||||
db_change_callback=self.controller.db_change_callback,
|
db_change_callback=self.controller.db_change_callback,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
self.open_flow_app = switch_backend.open_flow_app
|
self.open_flow_app = switch_backend.open_flow_app
|
||||||
|
|
|
@ -19,7 +19,7 @@ from dragonflow.db import field_types as df_fields
|
||||||
from dragonflow.db import model_framework
|
from dragonflow.db import model_framework
|
||||||
from dragonflow.db.models import core
|
from dragonflow.db.models import core
|
||||||
from dragonflow.db.models import mixins
|
from dragonflow.db.models import mixins
|
||||||
from dragonflow.switch.drivers.ovs import ryu_base_app
|
from dragonflow.switch.drivers.ovs import os_ken_base_app
|
||||||
from dragonflow.tests.common import utils
|
from dragonflow.tests.common import utils
|
||||||
from dragonflow.tests.unit import test_app_base
|
from dragonflow.tests.unit import test_app_base
|
||||||
|
|
||||||
|
@ -38,13 +38,14 @@ class DfLocalControllerTestCase(test_app_base.DFAppTestBase):
|
||||||
|
|
||||||
apps_list = ["l2"]
|
apps_list = ["l2"]
|
||||||
|
|
||||||
@mock.patch.object(ryu_base_app.RyuDFAdapter,
|
@mock.patch.object(os_ken_base_app.OsKenDFAdapter,
|
||||||
'notify_switch_sync_finished')
|
'notify_switch_sync_finished')
|
||||||
def test_switch_sync_finished(self, mock_notify):
|
def test_switch_sync_finished(self, mock_notify):
|
||||||
self.controller.switch_sync_finished()
|
self.controller.switch_sync_finished()
|
||||||
mock_notify.assert_called_once()
|
mock_notify.assert_called_once()
|
||||||
|
|
||||||
@mock.patch.object(ryu_base_app.RyuDFAdapter, 'notify_switch_sync_started')
|
@mock.patch.object(os_ken_base_app.OsKenDFAdapter,
|
||||||
|
'notify_switch_sync_started')
|
||||||
def test_switch_sync_started(self, mock_notify):
|
def test_switch_sync_started(self, mock_notify):
|
||||||
self.controller.switch_sync_started()
|
self.controller.switch_sync_started()
|
||||||
mock_notify.assert_called_once()
|
mock_notify.assert_called_once()
|
||||||
|
|
|
@ -17,13 +17,13 @@ import copy
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron_lib import constants as n_const
|
from neutron_lib import constants as n_const
|
||||||
|
from os_ken.lib import addrconv
|
||||||
|
from os_ken.lib.packet import dhcp
|
||||||
|
from os_ken.lib.packet import ethernet
|
||||||
|
from os_ken.lib.packet import ipv4
|
||||||
|
from os_ken.lib.packet import packet as os_ken_packet
|
||||||
|
from os_ken.ofproto import ether
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from ryu.lib import addrconv
|
|
||||||
from ryu.lib.packet import dhcp
|
|
||||||
from ryu.lib.packet import ethernet
|
|
||||||
from ryu.lib.packet import ipv4
|
|
||||||
from ryu.lib.packet import packet as ryu_packet
|
|
||||||
from ryu.ofproto import ether
|
|
||||||
|
|
||||||
from dragonflow.controller.common import constants as const
|
from dragonflow.controller.common import constants as const
|
||||||
from dragonflow.tests.unit import test_app_base
|
from dragonflow.tests.unit import test_app_base
|
||||||
|
@ -129,7 +129,7 @@ class TestDHCPApp(test_app_base.DFAppTestBase):
|
||||||
return dhcp_response_pkt
|
return dhcp_response_pkt
|
||||||
|
|
||||||
def _create_fake_empty_packet(self):
|
def _create_fake_empty_packet(self):
|
||||||
pkt = ryu_packet.Packet()
|
pkt = os_ken_packet.Packet()
|
||||||
pkt.add_protocol(ethernet.ethernet(
|
pkt.add_protocol(ethernet.ethernet(
|
||||||
ethertype=ether.ETH_TYPE_IP))
|
ethertype=ether.ETH_TYPE_IP))
|
||||||
pkt.add_protocol(ipv4.ipv4())
|
pkt.add_protocol(ipv4.ipv4())
|
||||||
|
|
|
@ -17,25 +17,25 @@ import mock
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from dragonflow import conf as cfg
|
from dragonflow import conf as cfg
|
||||||
from dragonflow.switch.drivers.ovs import ryu_base_app
|
from dragonflow.switch.drivers.ovs import os_ken_base_app
|
||||||
from dragonflow.tests import base as tests_base
|
from dragonflow.tests import base as tests_base
|
||||||
|
|
||||||
|
|
||||||
class TestRyuDFAdapter(tests_base.BaseTestCase):
|
class TestOsKenDFAdapter(tests_base.BaseTestCase):
|
||||||
"""
|
"""
|
||||||
This unit test has to verify that all events are called correctly, both
|
This unit test has to verify that all events are called correctly, both
|
||||||
via the notify* functions, as well as the events called from ryu.
|
via the notify* functions, as well as the events called from os_ken.
|
||||||
|
|
||||||
Having ryu call these events will be done in the functional tests.
|
Having os_ken call these events will be done in the functional tests.
|
||||||
"""
|
"""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestRyuDFAdapter, self).setUp()
|
super(TestOsKenDFAdapter, self).setUp()
|
||||||
cfg.CONF.set_override(
|
cfg.CONF.set_override(
|
||||||
'datapath_layout_path',
|
'datapath_layout_path',
|
||||||
'etc/dragonflow_datapath_layout.yaml',
|
'etc/dragonflow_datapath_layout.yaml',
|
||||||
group='df',
|
group='df',
|
||||||
)
|
)
|
||||||
self.ryu_df_adapter = ryu_base_app.RyuDFAdapter(
|
self.os_ken_df_adapter = os_ken_base_app.OsKenDFAdapter(
|
||||||
switch_backend=mock.Mock(),
|
switch_backend=mock.Mock(),
|
||||||
nb_api=mock.Mock(),
|
nb_api=mock.Mock(),
|
||||||
db_change_callback=mock.Mock())
|
db_change_callback=mock.Mock())
|
||||||
|
@ -50,9 +50,9 @@ class TestRyuDFAdapter(tests_base.BaseTestCase):
|
||||||
])
|
])
|
||||||
|
|
||||||
def dispatcher_load(*args, **kwargs):
|
def dispatcher_load(*args, **kwargs):
|
||||||
self.ryu_df_adapter.dispatcher.apps = {'mock': self.mock_app}
|
self.os_ken_df_adapter.dispatcher.apps = {'mock': self.mock_app}
|
||||||
self.ryu_df_adapter.dispatcher.load = dispatcher_load
|
self.os_ken_df_adapter.dispatcher.load = dispatcher_load
|
||||||
self.ryu_df_adapter.load()
|
self.os_ken_df_adapter.load()
|
||||||
|
|
||||||
def test_switch_features_handler(self):
|
def test_switch_features_handler(self):
|
||||||
self.mock_app.reset_mock()
|
self.mock_app.reset_mock()
|
||||||
|
@ -61,13 +61,13 @@ class TestRyuDFAdapter(tests_base.BaseTestCase):
|
||||||
ev.msg.datapath = mock.Mock()
|
ev.msg.datapath = mock.Mock()
|
||||||
ev.msg.datapath.ofproto = mock.Mock()
|
ev.msg.datapath.ofproto = mock.Mock()
|
||||||
ev.msg.datapath.ofproto.OFP_VERSION = 0x04
|
ev.msg.datapath.ofproto.OFP_VERSION = 0x04
|
||||||
self.ryu_df_adapter.switch_features_handler(ev)
|
self.os_ken_df_adapter.switch_features_handler(ev)
|
||||||
self.mock_app.assert_has_calls([mock.call.switch_features_handler(ev)])
|
self.mock_app.assert_has_calls([mock.call.switch_features_handler(ev)])
|
||||||
|
|
||||||
def test_port_desc_stats_reply_handler(self):
|
def test_port_desc_stats_reply_handler(self):
|
||||||
self.mock_app.reset_mock()
|
self.mock_app.reset_mock()
|
||||||
ev = mock.Mock()
|
ev = mock.Mock()
|
||||||
self.ryu_df_adapter.port_desc_stats_reply_handler(ev)
|
self.os_ken_df_adapter.port_desc_stats_reply_handler(ev)
|
||||||
self.mock_app.assert_has_calls([
|
self.mock_app.assert_has_calls([
|
||||||
mock.call.port_desc_stats_reply_handler(ev)])
|
mock.call.port_desc_stats_reply_handler(ev)])
|
||||||
|
|
||||||
|
@ -76,12 +76,12 @@ class TestRyuDFAdapter(tests_base.BaseTestCase):
|
||||||
ev = mock.Mock()
|
ev = mock.Mock()
|
||||||
ev.msg.table_id = 10
|
ev.msg.table_id = 10
|
||||||
self.mock_app.packet_in_handler.__name__ = 'mock'
|
self.mock_app.packet_in_handler.__name__ = 'mock'
|
||||||
self.ryu_df_adapter.register_table_handler(
|
self.os_ken_df_adapter.register_table_handler(
|
||||||
10, self.mock_app.packet_in_handler)
|
10, self.mock_app.packet_in_handler)
|
||||||
self.ryu_df_adapter.OF_packet_in_handler(ev)
|
self.os_ken_df_adapter.OF_packet_in_handler(ev)
|
||||||
self.mock_app.assert_has_calls([mock.call.packet_in_handler(ev)])
|
self.mock_app.assert_has_calls([mock.call.packet_in_handler(ev)])
|
||||||
|
|
||||||
def test_register_twice(self):
|
def test_register_twice(self):
|
||||||
self.ryu_df_adapter.register_table_handler(0, 0)
|
self.os_ken_df_adapter.register_table_handler(0, 0)
|
||||||
with testtools.ExpectedException(RuntimeError):
|
with testtools.ExpectedException(RuntimeError):
|
||||||
self.ryu_df_adapter.register_table_handler(0, 0)
|
self.os_ken_df_adapter.register_table_handler(0, 0)
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import netaddr
|
import netaddr
|
||||||
import ryu.lib.packet
|
import os_ken.lib.packet
|
||||||
|
|
||||||
from dragonflow.controller.common import constants
|
from dragonflow.controller.common import constants
|
||||||
from dragonflow.controller import port_locator
|
from dragonflow.controller import port_locator
|
||||||
|
@ -228,20 +228,20 @@ class TestTrunkSegmentationTypesMACVLAN(_TestTrunkSegmentationTypes,
|
||||||
{
|
{
|
||||||
'reg6': test_app_base.fake_local_port2.unique_key,
|
'reg6': test_app_base.fake_local_port2.unique_key,
|
||||||
'eth_src': netaddr.EUI('fa:16:3e:00:00:01'),
|
'eth_src': netaddr.EUI('fa:16:3e:00:00:01'),
|
||||||
'eth_type': ryu.lib.packet.ether_types.ETH_TYPE_IP,
|
'eth_type': os_ken.lib.packet.ether_types.ETH_TYPE_IP,
|
||||||
'ipv4_src': netaddr.IPAddress('192.168.18.3'),
|
'ipv4_src': netaddr.IPAddress('192.168.18.3'),
|
||||||
}, {
|
}, {
|
||||||
'reg7': 33,
|
'reg7': 33,
|
||||||
'eth_type': ryu.lib.packet.ether_types.ETH_TYPE_IP,
|
'eth_type': os_ken.lib.packet.ether_types.ETH_TYPE_IP,
|
||||||
}, {
|
}, {
|
||||||
'reg6': test_app_base.fake_local_port2.unique_key,
|
'reg6': test_app_base.fake_local_port2.unique_key,
|
||||||
'eth_src': netaddr.EUI('fa:16:3e:00:00:01'),
|
'eth_src': netaddr.EUI('fa:16:3e:00:00:01'),
|
||||||
'eth_type': ryu.lib.packet.ether_types.ETH_TYPE_ARP,
|
'eth_type': os_ken.lib.packet.ether_types.ETH_TYPE_ARP,
|
||||||
'arp_sha': netaddr.EUI('fa:16:3e:00:00:01'),
|
'arp_sha': netaddr.EUI('fa:16:3e:00:00:01'),
|
||||||
'arp_spa': netaddr.IPAddress('192.168.18.3'),
|
'arp_spa': netaddr.IPAddress('192.168.18.3'),
|
||||||
}, {
|
}, {
|
||||||
'reg7': 33,
|
'reg7': 33,
|
||||||
'eth_type': ryu.lib.packet.ether_types.ETH_TYPE_ARP,
|
'eth_type': os_ken.lib.packet.ether_types.ETH_TYPE_ARP,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -277,20 +277,20 @@ class TestTrunkSegmentationTypesIPVLAN(_TestTrunkSegmentationTypes,
|
||||||
{
|
{
|
||||||
'reg6': test_app_base.fake_local_port2.unique_key,
|
'reg6': test_app_base.fake_local_port2.unique_key,
|
||||||
'eth_src': test_app_base.fake_local_port2.mac,
|
'eth_src': test_app_base.fake_local_port2.mac,
|
||||||
'eth_type': ryu.lib.packet.ether_types.ETH_TYPE_IP,
|
'eth_type': os_ken.lib.packet.ether_types.ETH_TYPE_IP,
|
||||||
'ipv4_src': netaddr.IPAddress('192.168.18.3'),
|
'ipv4_src': netaddr.IPAddress('192.168.18.3'),
|
||||||
}, {
|
}, {
|
||||||
'reg7': 33,
|
'reg7': 33,
|
||||||
'eth_type': ryu.lib.packet.ether_types.ETH_TYPE_IP,
|
'eth_type': os_ken.lib.packet.ether_types.ETH_TYPE_IP,
|
||||||
}, {
|
}, {
|
||||||
'reg6': test_app_base.fake_local_port2.unique_key,
|
'reg6': test_app_base.fake_local_port2.unique_key,
|
||||||
'eth_src': test_app_base.fake_local_port2.mac,
|
'eth_src': test_app_base.fake_local_port2.mac,
|
||||||
'eth_type': ryu.lib.packet.ether_types.ETH_TYPE_ARP,
|
'eth_type': os_ken.lib.packet.ether_types.ETH_TYPE_ARP,
|
||||||
'arp_sha': test_app_base.fake_local_port2.mac,
|
'arp_sha': test_app_base.fake_local_port2.mac,
|
||||||
'arp_spa': netaddr.IPAddress('192.168.18.3'),
|
'arp_spa': netaddr.IPAddress('192.168.18.3'),
|
||||||
}, {
|
}, {
|
||||||
'reg7': 33,
|
'reg7': 33,
|
||||||
'eth_type': ryu.lib.packet.ether_types.ETH_TYPE_ARP,
|
'eth_type': os_ken.lib.packet.ether_types.ETH_TYPE_ARP,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -31,5 +31,5 @@ metadata_interface = tap-metadata
|
||||||
port = 18080
|
port = 18080
|
||||||
ip = 169.254.169.254
|
ip = 169.254.169.254
|
||||||
|
|
||||||
[df_ryu]
|
[df_os_ken]
|
||||||
of_listen_address = LOCAL_IP
|
of_listen_address = LOCAL_IP
|
||||||
|
|
|
@ -71,6 +71,7 @@ os-service-types==1.2.0
|
||||||
os-testr==1.0.0
|
os-testr==1.0.0
|
||||||
os-xenapi==0.3.1
|
os-xenapi==0.3.1
|
||||||
osc-lib==1.10.0
|
osc-lib==1.10.0
|
||||||
|
os-ken==0.3.0
|
||||||
oslo.cache==1.29.0
|
oslo.cache==1.29.0
|
||||||
oslo.concurrency==3.26.0
|
oslo.concurrency==3.26.0
|
||||||
oslo.config==5.2.0
|
oslo.config==5.2.0
|
||||||
|
@ -130,7 +131,6 @@ requests==2.18.4
|
||||||
requestsexceptions==1.4.0
|
requestsexceptions==1.4.0
|
||||||
rfc3986==1.1.0
|
rfc3986==1.1.0
|
||||||
Routes==2.4.1
|
Routes==2.4.1
|
||||||
ryu==4.24
|
|
||||||
simplejson==3.13.2
|
simplejson==3.13.2
|
||||||
six==1.11.0
|
six==1.11.0
|
||||||
skydive-client==0.4.5
|
skydive-client==0.4.5
|
||||||
|
|
|
@ -7,9 +7,9 @@ Babel!=2.4.0,>=2.3.4 # BSD
|
||||||
etcd3gw>=0.2.0 # Apache-2.0
|
etcd3gw>=0.2.0 # Apache-2.0
|
||||||
cassandra-driver!=3.6.0,>=2.1.4 # Apache-2.0
|
cassandra-driver!=3.6.0,>=2.1.4 # Apache-2.0
|
||||||
kazoo>=2.2 # Apache-2.0
|
kazoo>=2.2 # Apache-2.0
|
||||||
|
os-ken>=0.3.0 # Apache-2.0
|
||||||
ovs>=2.8.0 # Apache-2.0
|
ovs>=2.8.0 # Apache-2.0
|
||||||
pyzmq>=14.3.1 # LGPL+BSD
|
pyzmq>=14.3.1 # LGPL+BSD
|
||||||
ryu>=4.24 # Apache-2.0
|
|
||||||
SQLAlchemy>=1.2.0 # MIT
|
SQLAlchemy>=1.2.0 # MIT
|
||||||
alembic>=0.8.10 # MIT
|
alembic>=0.8.10 # MIT
|
||||||
neutron-lib>=1.18.0 # Apache-2.0
|
neutron-lib>=1.18.0 # Apache-2.0
|
||||||
|
|
Loading…
Reference in New Issue