-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "config: introduces internet protocols constants"
- Loading branch information
Showing
10 changed files
with
164 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# | ||
# Copyright (c) 2020 Juniper Networks, Inc. All rights reserved. | ||
# | ||
|
||
"""Internet protocols. | ||
See also http://www.iana.org/assignments/protocol-numbers | ||
""" | ||
|
||
# Mostly inspired by: | ||
# https://github.com/openstack/neutron-lib/blob/master/neutron_lib/constants.py | ||
|
||
PROTO_NAME_AH = 'ah' | ||
PROTO_NAME_DCCP = 'dccp' | ||
PROTO_NAME_EGP = 'egp' | ||
PROTO_NAME_ESP = 'esp' | ||
PROTO_NAME_GRE = 'gre' | ||
PROTO_NAME_HOPOPT = 'hopopt' | ||
PROTO_NAME_ICMP = 'icmp' | ||
PROTO_NAME_IGMP = 'igmp' | ||
PROTO_NAME_IP = 'ip' | ||
PROTO_NAME_IPIP = 'ipip' | ||
PROTO_NAME_IPV6_ENCAP = 'ipv6-encap' | ||
PROTO_NAME_IPV6_FRAG = 'ipv6-frag' | ||
PROTO_NAME_IPV6_ICMP = 'ipv6-icmp' | ||
PROTO_NAME_IPV6_NONXT = 'ipv6-nonxt' | ||
PROTO_NAME_IPV6_OPTS = 'ipv6-opts' | ||
PROTO_NAME_IPV6_ROUTE = 'ipv6-route' | ||
PROTO_NAME_OSPF = 'ospf' | ||
PROTO_NAME_PGM = 'pgm' | ||
PROTO_NAME_RSVP = 'rsvp' | ||
PROTO_NAME_SCTP = 'sctp' | ||
PROTO_NAME_TCP = 'tcp' | ||
PROTO_NAME_UDP = 'udp' | ||
PROTO_NAME_UDPLITE = 'udplite' | ||
PROTO_NAME_VRRP = 'vrrp' | ||
# Contrail specific | ||
PROTO_NAME_ICMP6 = 'icmp6' | ||
PROTO_NAME_ANY = 'any' | ||
|
||
|
||
PROTO_NUM_AH = 51 | ||
PROTO_NUM_DCCP = 33 | ||
PROTO_NUM_EGP = 8 | ||
PROTO_NUM_ESP = 50 | ||
PROTO_NUM_GRE = 47 | ||
PROTO_NUM_HOPOPT = 0 | ||
PROTO_NUM_ICMP = 1 | ||
PROTO_NUM_IGMP = 2 | ||
PROTO_NUM_IP = 0 | ||
PROTO_NUM_IPIP = 4 | ||
PROTO_NUM_IPV6_ENCAP = 41 | ||
PROTO_NUM_IPV6_FRAG = 44 | ||
PROTO_NUM_IPV6_ICMP = 58 | ||
PROTO_NUM_IPV6_NONXT = 59 | ||
PROTO_NUM_IPV6_OPTS = 60 | ||
PROTO_NUM_IPV6_ROUTE = 43 | ||
PROTO_NUM_OSPF = 89 | ||
PROTO_NUM_PGM = 113 | ||
PROTO_NUM_RSVP = 46 | ||
PROTO_NUM_SCTP = 132 | ||
PROTO_NUM_TCP = 6 | ||
PROTO_NUM_UDP = 17 | ||
PROTO_NUM_UDPLITE = 136 | ||
PROTO_NUM_VRRP = 112 | ||
# Contrail specific | ||
PROTO_NUM_ICMP6 = 58 | ||
PROTO_NUM_ANY = 'any' | ||
|
||
|
||
IP_PROTOCOL_MAP = { | ||
PROTO_NAME_AH: PROTO_NUM_AH, | ||
PROTO_NAME_DCCP: PROTO_NUM_DCCP, | ||
PROTO_NAME_EGP: PROTO_NUM_EGP, | ||
PROTO_NAME_ESP: PROTO_NUM_ESP, | ||
PROTO_NAME_GRE: PROTO_NUM_GRE, | ||
PROTO_NAME_HOPOPT: PROTO_NUM_HOPOPT, | ||
PROTO_NAME_ICMP: PROTO_NUM_ICMP, | ||
PROTO_NAME_IGMP: PROTO_NUM_IGMP, | ||
PROTO_NAME_IP: PROTO_NUM_IP, | ||
PROTO_NAME_IPIP: PROTO_NUM_IPIP, | ||
PROTO_NAME_IPV6_ENCAP: PROTO_NUM_IPV6_ENCAP, | ||
PROTO_NAME_IPV6_FRAG: PROTO_NUM_IPV6_FRAG, | ||
PROTO_NAME_IPV6_ICMP: PROTO_NUM_IPV6_ICMP, | ||
PROTO_NAME_IPV6_NONXT: PROTO_NUM_IPV6_NONXT, | ||
PROTO_NAME_IPV6_OPTS: PROTO_NUM_IPV6_OPTS, | ||
PROTO_NAME_IPV6_ROUTE: PROTO_NUM_IPV6_ROUTE, | ||
PROTO_NAME_OSPF: PROTO_NUM_OSPF, | ||
PROTO_NAME_PGM: PROTO_NUM_PGM, | ||
PROTO_NAME_RSVP: PROTO_NUM_RSVP, | ||
PROTO_NAME_SCTP: PROTO_NUM_SCTP, | ||
PROTO_NAME_TCP: PROTO_NUM_TCP, | ||
PROTO_NAME_UDP: PROTO_NUM_UDP, | ||
PROTO_NAME_UDPLITE: PROTO_NUM_UDPLITE, | ||
PROTO_NAME_VRRP: PROTO_NUM_VRRP, | ||
PROTO_NAME_ICMP6: PROTO_NUM_ICMP6, | ||
PROTO_NAME_ANY: PROTO_NUM_ANY} | ||
|
||
|
||
IP_PROTOCOL_NAMES = list(IP_PROTOCOL_MAP.keys()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters