public final class ProtocolUtils extends Object
ProtocolUtils class is a collection of utilities for network
protocol handling.| Modifier and Type | Field and Description |
|---|---|
static long |
MASK_ETHER_TYPE
Mask value which represents valid bits in an ethernet type.
|
static long |
MASK_VLAN_ID
Mask value which represents a VLAN ID bits in a long integer.
|
static int |
NBITS_VLAN_ID
The number of bits in a valid VLAN ID.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
checkEtherType(int type)
Check the given ethernet type.
|
static void |
checkIcmpValue(Short value,
String desc)
Check the specified ICMP type or code value.
|
static void |
checkIpDscp(short dscp)
Check the specified IP DSCP field value.
|
static void |
checkIpProtocol(short proto)
Check the specified IP protocol number.
|
static void |
checkPortNumber(int port)
Check the specified port number of IP transport layer protocol.
|
static void |
checkVlan(int vlan)
Check the specified VLAN ID.
|
static void |
checkVlan(short vlan)
Check the specified VLAN ID.
|
static void |
checkVlanPriority(short pri)
Check the specified VLAN priority.
|
static int |
dscpToTos(short dscp)
Convert the given IP DSCP value into a TOS value.
|
static Integer |
getEtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetType etype)
Return the ethernet type in the given
EthernetType instance. |
static Integer |
getEtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType etype)
Return the ethernet type in the given
EtherType instance. |
static Short |
getIpDscp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp dscp)
Return the IP DSCP field value configured in the given
Dscp
instance. |
static Integer |
getPortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber port)
Return the port number configured in the given
PortNumber
instance. |
static Integer |
getVlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vid)
Return the VLAN ID in the given
VlanId instance. |
static Short |
getVlanPriority(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp pcp)
Return the VLAN priority in the given
VlanPcp instance. |
static boolean |
isDscpValid(short dscp)
Determine whether the specified IP DSCP value is valid or not.
|
static boolean |
isIcmpValueValid(short value)
Determine whether the specified ICMP type or code value is valid or not.
|
static boolean |
isPortNumberValid(int port)
Determine whether the specified port number of transport layer protocol
is valid or not.
|
static boolean |
isVlanPriorityValid(short pri)
Determine whether the specified VLAN priority value is valid or not.
|
static short |
tosToDscp(int tos)
Convert the given IP TOS value into a DSCP value.
|
public static final int NBITS_VLAN_ID
public static final long MASK_ETHER_TYPE
public static final long MASK_VLAN_ID
public static void checkEtherType(int type)
throws RpcException
type - The ethernet type to be checked.RpcException - The given ethernet type is invalid.public static Integer getEtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType etype) throws RpcException
EtherType instance.etype - An EtherType instance.Integer instance if the ethernet type is present
in the given EtherType instance.
Otherwise null.RpcException - The given ethernet type is invalid.public static Integer getEtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetType etype) throws RpcException
EthernetType instance.etype - An EthernetType instance.Integer instance if the ethernet type is present
in the given EthernetType instance.
Otherwise null.RpcException - The given ethernet type is invalid.public static void checkVlan(short vlan)
throws RpcException
vlan - VLAN ID.RpcException - The specified VLAN ID is invalid.public static void checkVlan(int vlan)
throws RpcException
vlan - VLAN ID.RpcException - The specified VLAN ID is invalid.public static Integer getVlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vid) throws RpcException
VlanId instance.vid - A VlanId instance.Integer instance if the VLAN ID is present in the
given VlanId instance.
Otherwise null.RpcException - The given VLAN ID is invalid.public static boolean isVlanPriorityValid(short pri)
pri - A VLAN priority.true only if the given VLAN priority is valid.public static void checkVlanPriority(short pri)
throws RpcException
pri - A VLAN priority.RpcException - The specified VLAN priority is invalid.public static Short getVlanPriority(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp pcp) throws RpcException
VlanPcp instance.pcp - A VlanPcp instance.Short instance if the VLAN priority is present in
the given VlanPcp instance.
Otherwise null.RpcException - The given VLAN priority is invalid.public static void checkIpProtocol(short proto)
throws RpcException
proto - An IP protocol number.RpcException - The specified IP protocol number is invalid.public static boolean isDscpValid(short dscp)
dscp - A DSCP value.true only if the given DSCP value is valid.public static void checkIpDscp(short dscp)
throws RpcException
dscp - An IP DSCP field value.RpcException - The specified IP DSCP value is invalid.public static Short getIpDscp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp dscp) throws RpcException
Dscp
instance.dscp - A Dscp instance.Short instance if the DSCP value is present in the
given Dscp instance.
Otherwise null.RpcException - The given DSCP value is invalid.public static int dscpToTos(short dscp)
dscp - A DSCP value.public static short tosToDscp(int tos)
tos - A TOS value.public static boolean isIcmpValueValid(short value)
value - An ICMP type or code.true only if the given value is valid.public static void checkIcmpValue(Short value, String desc) throws RpcException
value - An ICMP type or code.desc - A brief description about the given value.RpcException - The specified value is invalid.public static boolean isPortNumberValid(int port)
port - A port number.true only if the given port number is valid.public static void checkPortNumber(int port)
throws RpcException
port - A port number.RpcException - The specified port number is invalid.public static Integer getPortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber port) throws RpcException
PortNumber
instance.port - A PortNumber instance.Integer instance if the port number is present in
the given PortNumber instance.
Otherwise null.RpcException - The given port number is invalid.Copyright © 2018 OpenDaylight. All rights reserved.