Move the definitions of ether types and inet protocols to lib.packet
A motivation of this change is a better modularity. I.e. Make packet lib independent from ofproto. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
4de8c7425e
commit
b04e98faa7
@ -15,8 +15,8 @@
|
||||
|
||||
import struct
|
||||
|
||||
from ryu.ofproto import ether
|
||||
from ryu.lib import addrconv
|
||||
from . import ether_types as ether
|
||||
from . import packet_base
|
||||
|
||||
ARP_HW_TYPE_ETHERNET = 1 # ethernet hardware type
|
||||
|
27
ryu/lib/packet/ether_types.py
Normal file
27
ryu/lib/packet/ether_types.py
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
ETH_TYPE_IP = 0x0800
|
||||
ETH_TYPE_ARP = 0x0806
|
||||
ETH_TYPE_8021Q = 0x8100
|
||||
ETH_TYPE_IPV6 = 0x86dd
|
||||
ETH_TYPE_SLOW = 0x8809
|
||||
ETH_TYPE_MPLS = 0x8847
|
||||
ETH_TYPE_8021AD = 0x88a8
|
||||
ETH_TYPE_LLDP = 0x88cc
|
||||
ETH_TYPE_8021AH = 0x88e7
|
||||
ETH_TYPE_IEEE802_3 = 0x05dc
|
||||
ETH_TYPE_CFM = 0x8902
|
@ -17,7 +17,7 @@ import struct
|
||||
from . import packet_base
|
||||
from . import vlan
|
||||
from . import mpls
|
||||
from ryu.ofproto import ether
|
||||
from . import ether_types as ether
|
||||
from ryu.lib import addrconv
|
||||
|
||||
|
||||
|
31
ryu/lib/packet/in_proto.py
Normal file
31
ryu/lib/packet/in_proto.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
IPPROTO_IP = 0
|
||||
IPPROTO_HOPOPTS = 0
|
||||
IPPROTO_ICMP = 1
|
||||
IPPROTO_IGMP = 2
|
||||
IPPROTO_TCP = 6
|
||||
IPPROTO_UDP = 17
|
||||
IPPROTO_ROUTING = 43
|
||||
IPPROTO_FRAGMENT = 44
|
||||
IPPROTO_AH = 51
|
||||
IPPROTO_ICMPV6 = 58
|
||||
IPPROTO_NONE = 59
|
||||
IPPROTO_DSTOPTS = 60
|
||||
IPPROTO_OSPF = 89
|
||||
IPPROTO_VRRP = 112
|
||||
IPPROTO_SCTP = 132
|
@ -23,7 +23,7 @@ from . import udp
|
||||
from . import tcp
|
||||
from . import sctp
|
||||
from . import ospf
|
||||
from ryu.ofproto import inet
|
||||
from . import in_proto as inet
|
||||
from ryu.lib import addrconv
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ from . import icmpv6
|
||||
from . import tcp
|
||||
from . import udp
|
||||
from . import sctp
|
||||
from ryu.ofproto import inet
|
||||
from . import in_proto as inet
|
||||
from ryu.lib import addrconv
|
||||
from ryu.lib import stringify
|
||||
|
||||
|
@ -17,7 +17,7 @@ import struct
|
||||
from . import packet_base
|
||||
from . import vlan
|
||||
from . import mpls
|
||||
from ryu.ofproto import ether
|
||||
from . import ether_types as ether
|
||||
from ryu.lib import addrconv
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ import socket
|
||||
from . import packet_base
|
||||
from . import packet_utils
|
||||
from . import ipv4
|
||||
from ryu.ofproto import ether
|
||||
from . import ether_types as ether
|
||||
|
||||
|
||||
class mpls(packet_base.PacketBase):
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
import struct
|
||||
from ryu.lib.packet import packet_base
|
||||
from ryu.ofproto import ether
|
||||
|
||||
|
||||
class itag(packet_base.PacketBase):
|
||||
|
@ -25,7 +25,7 @@ from . import slow
|
||||
from . import llc
|
||||
from . import pbb
|
||||
from . import cfm
|
||||
from ryu.ofproto import ether
|
||||
from . import ether_types as ether
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
|
@ -70,14 +70,14 @@ VRRP v3 packet format
|
||||
import struct
|
||||
|
||||
from ryu.lib.packet import ethernet
|
||||
from ryu.lib.packet import ether_types as ether
|
||||
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 packet
|
||||
from ryu.lib.packet import packet_base
|
||||
from ryu.lib.packet import packet_utils
|
||||
from ryu.lib.packet import vlan
|
||||
from ryu.ofproto import ether
|
||||
from ryu.ofproto import inet
|
||||
from ryu.lib import addrconv
|
||||
|
||||
|
||||
|
@ -1,27 +1,3 @@
|
||||
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# This module is for backward compat
|
||||
|
||||
|
||||
ETH_TYPE_IP = 0x0800
|
||||
ETH_TYPE_ARP = 0x0806
|
||||
ETH_TYPE_8021Q = 0x8100
|
||||
ETH_TYPE_IPV6 = 0x86dd
|
||||
ETH_TYPE_SLOW = 0x8809
|
||||
ETH_TYPE_MPLS = 0x8847
|
||||
ETH_TYPE_8021AD = 0x88a8
|
||||
ETH_TYPE_LLDP = 0x88cc
|
||||
ETH_TYPE_8021AH = 0x88e7
|
||||
ETH_TYPE_IEEE802_3 = 0x05dc
|
||||
ETH_TYPE_CFM = 0x8902
|
||||
from ryu.lib.packet.ether_types import *
|
||||
|
@ -1,31 +1,3 @@
|
||||
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# This module is for backward compat
|
||||
|
||||
|
||||
IPPROTO_IP = 0
|
||||
IPPROTO_HOPOPTS = 0
|
||||
IPPROTO_ICMP = 1
|
||||
IPPROTO_IGMP = 2
|
||||
IPPROTO_TCP = 6
|
||||
IPPROTO_UDP = 17
|
||||
IPPROTO_ROUTING = 43
|
||||
IPPROTO_FRAGMENT = 44
|
||||
IPPROTO_AH = 51
|
||||
IPPROTO_ICMPV6 = 58
|
||||
IPPROTO_NONE = 59
|
||||
IPPROTO_DSTOPTS = 60
|
||||
IPPROTO_OSPF = 89
|
||||
IPPROTO_VRRP = 112
|
||||
IPPROTO_SCTP = 132
|
||||
from ryu.lib.packet.in_proto import *
|
||||
|
Loading…
Reference in New Issue
Block a user