VOL-101 -handle barrier request

Change-Id: Ie236245af41de85d84cd3d61aa6957dd3299bca1
diff --git a/go.mod b/go.mod
index a526887..d4ff5b9 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@
 go 1.12
 
 require (
-	github.com/donNewtonAlpha/goloxi v0.0.0-20191114190442-56ef1a8d7bcc
+	github.com/donNewtonAlpha/goloxi v1.0.0
 	github.com/golang/protobuf v1.3.2
 	github.com/opencord/voltha-lib-go/v2 v2.2.23
 	github.com/opencord/voltha-protos/v2 v2.1.0
diff --git a/go.sum b/go.sum
index cfcd1c0..321d0e0 100644
--- a/go.sum
+++ b/go.sum
@@ -34,6 +34,8 @@
 github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 github.com/donNewtonAlpha/goloxi v0.0.0-20191114190442-56ef1a8d7bcc h1:o0ijbscb9OjCFSg13kkfGtdWkU6ep66eiKbX3h94BEk=
 github.com/donNewtonAlpha/goloxi v0.0.0-20191114190442-56ef1a8d7bcc/go.mod h1:mf2669Q9OEthwDwxdgO6fmRVZhM/3F+hhlvkFD7V/JI=
+github.com/donNewtonAlpha/goloxi v1.0.0 h1:aMRErR0P1PXN0JqfWwhjn33gD/NS5YB7bHi/ydsC36I=
+github.com/donNewtonAlpha/goloxi v1.0.0/go.mod h1:mf2669Q9OEthwDwxdgO6fmRVZhM/3F+hhlvkFD7V/JI=
 github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
 github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
 github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
diff --git a/openflow/openflowClient.go b/openflow/openflowClient.go
index 4925f4f..8922f0b 100644
--- a/openflow/openflowClient.go
+++ b/openflow/openflowClient.go
@@ -193,30 +193,36 @@
 		packetOut := header.(*ofp.PacketOut)
 		go handlePacketOut(packetOut, client.DeviceID)
 	case ofp.OFPTFlowMod:
+		/* Not using go routine to handle flow* messages or barrier requests
+		onos typically issues barrier requests just before a flow* message.
+		by handling in this thread I ensure all flow* are handled when barrier
+		request is issued.
+		*/
 		flowModType := uint8(buf[25])
 		switch flowModType {
 		case ofp.OFPFCAdd:
 			flowAdd := header.(*ofp.FlowAdd)
-			go handleFlowAdd(flowAdd, client.DeviceID)
+			handleFlowAdd(flowAdd, client.DeviceID)
 		case ofp.OFPFCModify:
 			flowMod := header.(*ofp.FlowMod)
-			go handleFlowMod(flowMod, client.DeviceID)
+			handleFlowMod(flowMod, client.DeviceID)
 		case ofp.OFPFCModifyStrict:
 			flowModStrict := header.(*ofp.FlowModifyStrict)
-			go handleFlowModStrict(flowModStrict, client.DeviceID)
+			handleFlowModStrict(flowModStrict, client.DeviceID)
 		case ofp.OFPFCDelete:
 			flowDelete := header.(*ofp.FlowDelete)
-			go handleFlowDelete(flowDelete, client.DeviceID)
+			handleFlowDelete(flowDelete, client.DeviceID)
 		case ofp.OFPFCDeleteStrict:
 			flowDeleteStrict := header.(*ofp.FlowDeleteStrict)
-			go handleFlowDeleteStrict(flowDeleteStrict, client.DeviceID)
+			handleFlowDeleteStrict(flowDeleteStrict, client.DeviceID)
 		}
 	case ofp.OFPTStatsRequest:
 		var statType = uint16(buf[8])<<8 + uint16(buf[9])
 		go handleStatsRequest(header, statType, client.DeviceID, client)
 	case ofp.OFPTBarrierRequest:
+		/* See note above at case ofp.OFPTFlowMod:*/
 		barRequest := header.(*ofp.BarrierRequest)
-		go handleBarrierRequest(barRequest, client.DeviceID, client)
+		handleBarrierRequest(barRequest, client.DeviceID, client)
 	case ofp.OFPTRoleRequest:
 		roleReq := header.(*ofp.RoleRequest)
 		go handleRoleRequest(roleReq, client.DeviceID, client)
diff --git a/run.sh b/run.sh
old mode 100644
new mode 100755
diff --git a/vendor/github.com/donNewtonAlpha/goloxi/of13/action.go b/vendor/github.com/donNewtonAlpha/goloxi/of13/action.go
index 4ee2f6b..d5459a7 100644
--- a/vendor/github.com/donNewtonAlpha/goloxi/of13/action.go
+++ b/vendor/github.com/donNewtonAlpha/goloxi/of13/action.go
@@ -5697,9 +5697,9 @@
 	}
 
 	self.Field.Serialize(encoder)
+	encoder.SkipAlign()
 
 	binary.BigEndian.PutUint16(encoder.Bytes()[2:4], uint16(len(encoder.Bytes())))
-	encoder.SkipAlign()
 
 	return nil
 }
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 3ecaeb6..a1f00f1 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,4 +1,4 @@
-# github.com/donNewtonAlpha/goloxi v0.0.0-20191114190442-56ef1a8d7bcc
+# github.com/donNewtonAlpha/goloxi v1.0.0
 github.com/donNewtonAlpha/goloxi
 github.com/donNewtonAlpha/goloxi/of13
 # github.com/golang/protobuf v1.3.2