Skip to content

Commit e406b3d

Browse files
authored
Merge pull request #601 from abhinandanpb/fix597
Fixing issue 597
2 parents df687db + 59bb62c commit e406b3d

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

netmaster/master/network.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,6 @@ func CreateNetwork(network intent.ConfigNetwork, stateDriver core.StateDriver, t
119119
nwCfg.ID = networkID
120120
nwCfg.StateDriver = stateDriver
121121

122-
// Allocate pkt tags
123-
reqPktTag := uint(network.PktTag)
124-
if nwCfg.PktTagType == "vlan" {
125-
pktTag, err = gCfg.AllocVLAN(reqPktTag)
126-
if err != nil {
127-
return err
128-
}
129-
} else if nwCfg.PktTagType == "vxlan" {
130-
extPktTag, pktTag, err = gCfg.AllocVXLAN(reqPktTag)
131-
if err != nil {
132-
return err
133-
}
134-
}
135-
136-
nwCfg.ExtPktTag = int(extPktTag)
137-
nwCfg.PktTag = int(pktTag)
138-
139122
netutils.InitSubnetBitset(&nwCfg.IPAllocMap, nwCfg.SubnetLen)
140123
subnetAddr := netutils.GetSubnetAddr(nwCfg.SubnetIP, nwCfg.SubnetLen)
141124
nwCfg.SubnetIP = subnetAddr
@@ -169,6 +152,23 @@ func CreateNetwork(network intent.ConfigNetwork, stateDriver core.StateDriver, t
169152
netutils.ReserveIPv6HostID(hostID, &nwCfg.IPv6AllocMap)
170153
}
171154

155+
// Allocate pkt tags
156+
reqPktTag := uint(network.PktTag)
157+
if nwCfg.PktTagType == "vlan" {
158+
pktTag, err = gCfg.AllocVLAN(reqPktTag)
159+
if err != nil {
160+
return err
161+
}
162+
} else if nwCfg.PktTagType == "vxlan" {
163+
extPktTag, pktTag, err = gCfg.AllocVXLAN(reqPktTag)
164+
if err != nil {
165+
return err
166+
}
167+
}
168+
169+
nwCfg.ExtPktTag = int(extPktTag)
170+
nwCfg.PktTag = int(pktTag)
171+
172172
err = nwCfg.Write()
173173
if err != nil {
174174
return err

netmaster/objApi/objapi_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -996,10 +996,10 @@ func TestNetworkAddDeleteACIMode(t *testing.T) {
996996
checkCreateNetwork(t, false, "default", "contiv-ipv6", "", "vxlan", "10.1.1.1/16", "", 1, "2016:0617::/120", "")
997997
verifyNetworkState(t, "default", "contiv-ipv6", "data", "vxlan", "10.1.1.1", "", 16, 1, 1, "2016:0617::", "", 120)
998998
checkDeleteNetwork(t, false, "default", "contiv-ipv6")
999+
checkGlobalSet(t, false, "default", "1-4094", "1-10000", "bridge")
9991000

10001001
}
10011002

1002-
/*
10031003
// TestNetworkAddDelete tests network create/delete REST api
10041004
func TestNetworkAddDelete(t *testing.T) {
10051005
// Basic vlan network
@@ -1095,7 +1095,6 @@ func TestNetworkAddDelete(t *testing.T) {
10951095
// Try deleting a non-existing network
10961096
checkDeleteNetwork(t, true, "default", "contiv")
10971097
}
1098-
*/
10991098

11001099
func TestDynamicGlobalVlanRange(t *testing.T) {
11011100

0 commit comments

Comments
 (0)