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:
YAMAMOTO Takashi 2015-02-12 13:52:13 +09:00 committed by FUJITA Tomonori
parent 4de8c7425e
commit b04e98faa7
13 changed files with 71 additions and 66 deletions

View File

@ -15,8 +15,8 @@
import struct import struct
from ryu.ofproto import ether
from ryu.lib import addrconv from ryu.lib import addrconv
from . import ether_types as ether
from . import packet_base from . import packet_base
ARP_HW_TYPE_ETHERNET = 1 # ethernet hardware type ARP_HW_TYPE_ETHERNET = 1 # ethernet hardware type

View 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

View File

@ -17,7 +17,7 @@ import struct
from . import packet_base from . import packet_base
from . import vlan from . import vlan
from . import mpls from . import mpls
from ryu.ofproto import ether from . import ether_types as ether
from ryu.lib import addrconv from ryu.lib import addrconv

View 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

View File

@ -23,7 +23,7 @@ from . import udp
from . import tcp from . import tcp
from . import sctp from . import sctp
from . import ospf from . import ospf
from ryu.ofproto import inet from . import in_proto as inet
from ryu.lib import addrconv from ryu.lib import addrconv

View File

@ -21,7 +21,7 @@ from . import icmpv6
from . import tcp from . import tcp
from . import udp from . import udp
from . import sctp from . import sctp
from ryu.ofproto import inet from . import in_proto as inet
from ryu.lib import addrconv from ryu.lib import addrconv
from ryu.lib import stringify from ryu.lib import stringify

View File

@ -17,7 +17,7 @@ import struct
from . import packet_base from . import packet_base
from . import vlan from . import vlan
from . import mpls from . import mpls
from ryu.ofproto import ether from . import ether_types as ether
from ryu.lib import addrconv from ryu.lib import addrconv

View File

@ -18,7 +18,7 @@ import socket
from . import packet_base from . import packet_base
from . import packet_utils from . import packet_utils
from . import ipv4 from . import ipv4
from ryu.ofproto import ether from . import ether_types as ether
class mpls(packet_base.PacketBase): class mpls(packet_base.PacketBase):

View File

@ -15,7 +15,6 @@
import struct import struct
from ryu.lib.packet import packet_base from ryu.lib.packet import packet_base
from ryu.ofproto import ether
class itag(packet_base.PacketBase): class itag(packet_base.PacketBase):

View File

@ -25,7 +25,7 @@ from . import slow
from . import llc from . import llc
from . import pbb from . import pbb
from . import cfm from . import cfm
from ryu.ofproto import ether from . import ether_types as ether
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)

View File

@ -70,14 +70,14 @@ VRRP v3 packet format
import struct import struct
from ryu.lib.packet import ethernet 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 ipv4
from ryu.lib.packet import ipv6 from ryu.lib.packet import ipv6
from ryu.lib.packet import packet from ryu.lib.packet import packet
from ryu.lib.packet import packet_base from ryu.lib.packet import packet_base
from ryu.lib.packet import packet_utils from ryu.lib.packet import packet_utils
from ryu.lib.packet import vlan from ryu.lib.packet import vlan
from ryu.ofproto import ether
from ryu.ofproto import inet
from ryu.lib import addrconv from ryu.lib import addrconv

View File

@ -1,27 +1,3 @@
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation. # This module is for backward compat
#
# 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.
from ryu.lib.packet.ether_types import *
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

View File

@ -1,31 +1,3 @@
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation. # This module is for backward compat
#
# 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.
from ryu.lib.packet.in_proto import *
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