Skip to content

Commit

Permalink
Replace whitespace by underscore in id of service
Browse files Browse the repository at this point in the history
  • Loading branch information
hknutzen committed Nov 4, 2022
1 parent e4e5a5e commit 4a15488
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 42 deletions.
1 change: 1 addition & 0 deletions go/pkg/pass2/nsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func printNSXRules(fd *os.File, rData *routerData) {
if rData.ipv6 && proto == "icmp" {
name = strings.Replace(name, "icmp", "icmpv6", 1)
}
name = strings.Replace(name, " ", "_", 1)
name = "Netspoc-" + name
protoMap[name] = srcRgPrt{prt: prt, srcRg: srcRange}
return "/infra/services/" + name
Expand Down
42 changes: 21 additions & 21 deletions go/testdata/ipv6/nsx_ipv6.t
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 10,
"services": [
"/infra/services/Netspoc-tcp 22"
"/infra/services/Netspoc-tcp_22"
],
"source_groups": [
"/infra/domains/default/groups/Netspoc-v6g0"
Expand Down Expand Up @@ -358,7 +358,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 81"
"/infra/services/Netspoc-tcp_81"
],
"source_groups": [
"/infra/domains/default/groups/Netspoc-v6g1"
Expand Down Expand Up @@ -402,7 +402,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-udp 123:123"
"/infra/services/Netspoc-udp_123:123"
],
"source_groups": [
"::a01:10a"
Expand All @@ -421,7 +421,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 80"
"/infra/services/Netspoc-tcp_80"
],
"source_groups": [
"::a01:10a"
Expand All @@ -440,7 +440,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 8080"
"/infra/services/Netspoc-tcp_8080"
],
"source_groups": [
"::a01:10a"
Expand All @@ -459,7 +459,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-udp 123:1-65535"
"/infra/services/Netspoc-udp_123:1-65535"
],
"source_groups": [
"::a01:114"
Expand All @@ -478,7 +478,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 81"
"/infra/services/Netspoc-tcp_81"
],
"source_groups": [
"/infra/domains/default/groups/Netspoc-v6g1"
Expand Down Expand Up @@ -536,7 +536,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-tcp 22",
"id": "Netspoc-tcp_22",
"service_entries": [
{
"destination_ports": [
Expand All @@ -548,7 +548,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-tcp 80",
"id": "Netspoc-tcp_80",
"service_entries": [
{
"destination_ports": [
Expand All @@ -560,7 +560,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-tcp 8080",
"id": "Netspoc-tcp_8080",
"service_entries": [
{
"destination_ports": [
Expand All @@ -572,7 +572,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-tcp 81",
"id": "Netspoc-tcp_81",
"service_entries": [
{
"destination_ports": [
Expand All @@ -584,7 +584,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-udp 123:1-65535",
"id": "Netspoc-udp_123:1-65535",
"service_entries": [
{
"l4_protocol": "UDP",
Expand All @@ -596,7 +596,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-udp 123:123",
"id": "Netspoc-udp_123:123",
"service_entries": [
{
"destination_ports": [
Expand Down Expand Up @@ -688,7 +688,7 @@ service:s1 = {
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 80"
"/infra/services/Netspoc-tcp_80"
],
"source_groups": [
"/infra/domains/default/groups/Netspoc-v6g0"
Expand Down Expand Up @@ -737,7 +737,7 @@ service:s1 = {
],
"services": [
{
"id": "Netspoc-tcp 80",
"id": "Netspoc-tcp_80",
"service_entries": [
{
"destination_ports": [
Expand Down Expand Up @@ -866,7 +866,7 @@ service:s1 = {
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-icmpv6 8"
"/infra/services/Netspoc-icmpv6_8"
],
"source_groups": [
"::a01:100/120"
Expand All @@ -885,7 +885,7 @@ service:s1 = {
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-icmpv6 5/0"
"/infra/services/Netspoc-icmpv6_5/0"
],
"source_groups": [
"::a01:100/120"
Expand All @@ -904,7 +904,7 @@ service:s1 = {
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-proto 52"
"/infra/services/Netspoc-proto_52"
],
"source_groups": [
"::a01:100/120"
Expand Down Expand Up @@ -953,7 +953,7 @@ service:s1 = {
],
"services": [
{
"id": "Netspoc-icmpv6 5/0",
"id": "Netspoc-icmpv6_5/0",
"service_entries": [
{
"icmp_code": 0,
Expand All @@ -964,7 +964,7 @@ service:s1 = {
]
},
{
"id": "Netspoc-icmpv6 8",
"id": "Netspoc-icmpv6_8",
"service_entries": [
{
"icmp_type": 8,
Expand All @@ -974,7 +974,7 @@ service:s1 = {
]
},
{
"id": "Netspoc-proto 52",
"id": "Netspoc-proto_52",
"service_entries": [
{
"protocol_number": 52,
Expand Down
42 changes: 21 additions & 21 deletions go/testdata/nsx.t
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 10,
"services": [
"/infra/services/Netspoc-tcp 22"
"/infra/services/Netspoc-tcp_22"
],
"source_groups": [
"/infra/domains/default/groups/Netspoc-g0"
Expand Down Expand Up @@ -348,7 +348,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 81"
"/infra/services/Netspoc-tcp_81"
],
"source_groups": [
"/infra/domains/default/groups/Netspoc-g1"
Expand Down Expand Up @@ -392,7 +392,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-udp 123:123"
"/infra/services/Netspoc-udp_123:123"
],
"source_groups": [
"10.1.1.10"
Expand All @@ -411,7 +411,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 80"
"/infra/services/Netspoc-tcp_80"
],
"source_groups": [
"10.1.1.10"
Expand All @@ -430,7 +430,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 8080"
"/infra/services/Netspoc-tcp_8080"
],
"source_groups": [
"10.1.1.10"
Expand All @@ -449,7 +449,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-udp 123:1-65535"
"/infra/services/Netspoc-udp_123:1-65535"
],
"source_groups": [
"10.1.1.20"
Expand All @@ -468,7 +468,7 @@ Generated by Netspoc, version devel
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 81"
"/infra/services/Netspoc-tcp_81"
],
"source_groups": [
"/infra/domains/default/groups/Netspoc-g1"
Expand Down Expand Up @@ -526,7 +526,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-tcp 22",
"id": "Netspoc-tcp_22",
"service_entries": [
{
"destination_ports": [
Expand All @@ -538,7 +538,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-tcp 80",
"id": "Netspoc-tcp_80",
"service_entries": [
{
"destination_ports": [
Expand All @@ -550,7 +550,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-tcp 8080",
"id": "Netspoc-tcp_8080",
"service_entries": [
{
"destination_ports": [
Expand All @@ -562,7 +562,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-tcp 81",
"id": "Netspoc-tcp_81",
"service_entries": [
{
"destination_ports": [
Expand All @@ -574,7 +574,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-udp 123:1-65535",
"id": "Netspoc-udp_123:1-65535",
"service_entries": [
{
"l4_protocol": "UDP",
Expand All @@ -586,7 +586,7 @@ Generated by Netspoc, version devel
]
},
{
"id": "Netspoc-udp 123:123",
"id": "Netspoc-udp_123:123",
"service_entries": [
{
"destination_ports": [
Expand Down Expand Up @@ -677,7 +677,7 @@ service:s1 = {
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-tcp 80"
"/infra/services/Netspoc-tcp_80"
],
"source_groups": [
"/infra/domains/default/groups/Netspoc-g0"
Expand Down Expand Up @@ -726,7 +726,7 @@ service:s1 = {
],
"services": [
{
"id": "Netspoc-tcp 80",
"id": "Netspoc-tcp_80",
"service_entries": [
{
"destination_ports": [
Expand Down Expand Up @@ -853,7 +853,7 @@ service:s1 = {
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-icmp 8"
"/infra/services/Netspoc-icmp_8"
],
"source_groups": [
"10.1.1.0/24"
Expand All @@ -872,7 +872,7 @@ service:s1 = {
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-icmp 5/0"
"/infra/services/Netspoc-icmp_5/0"
],
"source_groups": [
"10.1.1.0/24"
Expand All @@ -891,7 +891,7 @@ service:s1 = {
],
"sequence_number": 20,
"services": [
"/infra/services/Netspoc-proto 52"
"/infra/services/Netspoc-proto_52"
],
"source_groups": [
"10.1.1.0/24"
Expand Down Expand Up @@ -940,7 +940,7 @@ service:s1 = {
],
"services": [
{
"id": "Netspoc-icmp 5/0",
"id": "Netspoc-icmp_5/0",
"service_entries": [
{
"icmp_code": 0,
Expand All @@ -951,7 +951,7 @@ service:s1 = {
]
},
{
"id": "Netspoc-icmp 8",
"id": "Netspoc-icmp_8",
"service_entries": [
{
"icmp_type": 8,
Expand All @@ -961,7 +961,7 @@ service:s1 = {
]
},
{
"id": "Netspoc-proto 52",
"id": "Netspoc-proto_52",
"service_entries": [
{
"protocol_number": 52,
Expand Down

0 comments on commit 4a15488

Please sign in to comment.