VOL-2153 import flow_utils from new location

Change-Id: Iecd3875574ecacd9fd2e96da9637d524724907f0
diff --git a/Makefile b/Makefile
index 87c8621..f28145f 100644
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@
 	--build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \
 	--build-arg org_opencord_vcs_dirty="${DOCKER_LABEL_VCS_DIRTY}"
 
-.PHONY: docker-build local-protos local-voltha
+.PHONY: docker-build local-protos local-lib-go
 
 # This should to be the first and default target in this Makefile
 help:
@@ -71,7 +71,7 @@
 	@echo "lint-sanity       : Run the Go language sanity tests (vet)"
 	@echo "lint-style        : Verify the Go standard format of the source"
 	@echo "local-protos      : Copies a local verison of the VOLTHA protos into the vendor directory"
-	@echo "local-voltha      : Copies a local version of the VOTLHA dependencies into the vendor directory"
+	@echo "local-lib-go      : Copies a local version of the VOTLHA dependencies into the vendor directory"
 	@echo "sca               : Runs various SCA through golangci-lint tool"
 	@echo "test              : Run unit tests, if any"
 	@echo
@@ -86,19 +86,18 @@
 	rm -rf vendor/github.com/opencord/voltha-protos/go/vendor
 endif
 
-local-voltha:
-ifdef LOCAL_VOLTHA
-	rm -rf vendor/github.com/opencord/voltha-go
-	mkdir -p vendor/github.com/opencord/voltha-go/
-	cp -rf ${LOCAL_VOLTHA} vendor/github.com/opencord/
-	rm -rf vendor/github.com/opencord/voltha-go/vendor
+## Local Development Helpers
+local-lib-go:
+ifdef LOCAL_LIB_GO
+	mkdir -p vendor/github.com/opencord/voltha-lib-go/pkg
+	cp -r ${LOCAL_LIB_GO}/pkg/* vendor/github.com/opencord/voltha-lib-go/pkg/
 endif
 
 ## Docker targets
 
 build: docker-build
 
-docker-build: local-protos local-voltha
+docker-build: local-protos local-lib-go
 	docker build $(DOCKER_BUILD_ARGS) -t ${ADAPTER_IMAGENAME} -f docker/Dockerfile.openolt .
 
 docker-push:
diff --git a/adaptercore/device_handler_test.go b/adaptercore/device_handler_test.go
index 9f189cf..ecfca4b 100644
--- a/adaptercore/device_handler_test.go
+++ b/adaptercore/device_handler_test.go
@@ -25,7 +25,7 @@
 
 	"github.com/golang/protobuf/ptypes"
 	"github.com/golang/protobuf/ptypes/any"
-	fu "github.com/opencord/voltha-go/rw_core/utils"
+	fu "github.com/opencord/voltha-lib-go/pkg/flows"
 	"github.com/opencord/voltha-lib-go/pkg/log"
 	"github.com/opencord/voltha-openolt-adapter/adaptercore/resourcemanager"
 	"github.com/opencord/voltha-openolt-adapter/mocks"
diff --git a/adaptercore/olt_platform.go b/adaptercore/olt_platform.go
index 4077e05..6293cd5 100644
--- a/adaptercore/olt_platform.go
+++ b/adaptercore/olt_platform.go
@@ -19,7 +19,7 @@
 
 import (
 	"errors"
-	"github.com/opencord/voltha-go/rw_core/utils"
+	"github.com/opencord/voltha-lib-go/pkg/flows"
 	"github.com/opencord/voltha-lib-go/pkg/log"
 	ofp "github.com/opencord/voltha-protos/go/openflow_13"
 	"github.com/opencord/voltha-protos/go/voltha"
@@ -186,29 +186,29 @@
 	var ethType uint32
 
 	if flowDirection == "upstream" {
-		if uniPortNo = utils.GetChildPortFromTunnelId(flow); uniPortNo == 0 {
-			for _, field := range utils.GetOfbFields(flow) {
-				if field.GetType() == utils.IN_PORT {
+		if uniPortNo = flows.GetChildPortFromTunnelId(flow); uniPortNo == 0 {
+			for _, field := range flows.GetOfbFields(flow) {
+				if field.GetType() == flows.IN_PORT {
 					uniPortNo = field.GetPort()
 					break
 				}
 			}
 		}
 	} else if flowDirection == "downstream" {
-		if uniPortNo = utils.GetChildPortFromTunnelId(flow); uniPortNo == 0 {
-			for _, field := range utils.GetOfbFields(flow) {
-				if field.GetType() == utils.METADATA {
-					for _, action := range utils.GetActions(flow) {
-						if action.Type == utils.OUTPUT {
+		if uniPortNo = flows.GetChildPortFromTunnelId(flow); uniPortNo == 0 {
+			for _, field := range flows.GetOfbFields(flow) {
+				if field.GetType() == flows.METADATA {
+					for _, action := range flows.GetActions(flow) {
+						if action.Type == flows.OUTPUT {
 							if out := action.GetOutput(); out != nil {
 								uniPortNo = out.GetPort()
 							}
 							break
 						}
 					}
-				} else if field.GetType() == utils.IN_PORT {
+				} else if field.GetType() == flows.IN_PORT {
 					inPort = field.GetPort()
-				} else if field.GetType() == utils.ETH_TYPE {
+				} else if field.GetType() == flows.ETH_TYPE {
 					ethType = field.GetEthType()
 				}
 			}
diff --git a/adaptercore/olt_platform_test.go b/adaptercore/olt_platform_test.go
index 974d684..9b300ab 100644
--- a/adaptercore/olt_platform_test.go
+++ b/adaptercore/olt_platform_test.go
@@ -22,7 +22,7 @@
 	"reflect"
 	"testing"
 
-	fu "github.com/opencord/voltha-go/rw_core/utils"
+	fu "github.com/opencord/voltha-lib-go/pkg/flows"
 	ofp "github.com/opencord/voltha-protos/go/openflow_13"
 	"github.com/opencord/voltha-protos/go/voltha"
 )
diff --git a/adaptercore/openolt_flowmgr.go b/adaptercore/openolt_flowmgr.go
index ca874d3..4132162 100644
--- a/adaptercore/openolt_flowmgr.go
+++ b/adaptercore/openolt_flowmgr.go
@@ -25,7 +25,7 @@
 	"fmt"
 	"math/big"
 
-	"github.com/opencord/voltha-go/rw_core/utils"
+	"github.com/opencord/voltha-lib-go/pkg/flows"
 	"github.com/opencord/voltha-lib-go/pkg/log"
 	tp "github.com/opencord/voltha-lib-go/pkg/techprofile"
 	rsrcMgr "github.com/opencord/voltha-openolt-adapter/adaptercore/resourcemanager"
@@ -1331,12 +1331,12 @@
 	   Flow Metadata carries Tech-Profile (TP) ID and is mandatory in all
 	   subscriber related flows.
 	*/
-	metadata := utils.GetMetadataFromWriteMetadataAction(flow)
+	metadata := flows.GetMetadataFromWriteMetadataAction(flow)
 	if metadata == 0 {
 		log.Error("Metadata is not present in flow which is mandatory")
 		return
 	}
-	TpID := utils.GetTechProfileIDFromWriteMetaData(metadata)
+	TpID := flows.GetTechProfileIDFromWriteMetaData(metadata)
 	kvstoreTpID := f.resourceMgr.GetTechProfileIDForOnu(intfID, onuID, uniID)
 	if kvstoreTpID == 0 {
 		log.Debugf("tpid-not-present-in-kvstore, using tp id %d from flow metadata", TpID)
@@ -1346,10 +1346,10 @@
 	}
 	log.Debugw("TPID for this subcriber", log.Fields{"TpId": TpID, "pon": intfID, "onuID": onuID, "uniID": uniID})
 	if IsUpstream(actionInfo[Output].(uint32)) {
-		UsMeterID = utils.GetMeterIdFromFlow(flow)
+		UsMeterID = flows.GetMeterIdFromFlow(flow)
 		log.Debugw("Upstream-flow-meter-id", log.Fields{"UsMeterID": UsMeterID})
 	} else {
-		DsMeterID = utils.GetMeterIdFromFlow(flow)
+		DsMeterID = flows.GetMeterIdFromFlow(flow)
 		log.Debugw("Downstream-flow-meter-id", log.Fields{"DsMeterID": DsMeterID})
 
 	}
@@ -1652,38 +1652,38 @@
 }
 
 func formulateClassifierInfoFromFlow(classifierInfo map[string]interface{}, flow *ofp.OfpFlowStats) {
-	for _, field := range utils.GetOfbFields(flow) {
-		if field.Type == utils.ETH_TYPE {
+	for _, field := range flows.GetOfbFields(flow) {
+		if field.Type == flows.ETH_TYPE {
 			classifierInfo[EthType] = field.GetEthType()
 			log.Debug("field-type-eth-type", log.Fields{"classifierInfo[ETH_TYPE]": classifierInfo[EthType].(uint32)})
-		} else if field.Type == utils.IP_PROTO {
+		} else if field.Type == flows.IP_PROTO {
 			classifierInfo[IPProto] = field.GetIpProto()
 			log.Debug("field-type-ip-proto", log.Fields{"classifierInfo[IP_PROTO]": classifierInfo[IPProto].(uint32)})
-		} else if field.Type == utils.IN_PORT {
+		} else if field.Type == flows.IN_PORT {
 			classifierInfo[InPort] = field.GetPort()
 			log.Debug("field-type-in-port", log.Fields{"classifierInfo[IN_PORT]": classifierInfo[InPort].(uint32)})
-		} else if field.Type == utils.VLAN_VID {
+		} else if field.Type == flows.VLAN_VID {
 			classifierInfo[VlanVid] = field.GetVlanVid()
 			log.Debug("field-type-vlan-vid", log.Fields{"classifierInfo[VLAN_VID]": classifierInfo[VlanVid].(uint32)})
-		} else if field.Type == utils.VLAN_PCP {
+		} else if field.Type == flows.VLAN_PCP {
 			classifierInfo[VlanPcp] = field.GetVlanPcp()
 			log.Debug("field-type-vlan-pcp", log.Fields{"classifierInfo[VLAN_PCP]": classifierInfo[VlanPcp].(uint32)})
-		} else if field.Type == utils.UDP_DST {
+		} else if field.Type == flows.UDP_DST {
 			classifierInfo[UDPDst] = field.GetUdpDst()
 			log.Debug("field-type-udp-dst", log.Fields{"classifierInfo[UDP_DST]": classifierInfo[UDPDst].(uint32)})
-		} else if field.Type == utils.UDP_SRC {
+		} else if field.Type == flows.UDP_SRC {
 			classifierInfo[UDPSrc] = field.GetUdpSrc()
 			log.Debug("field-type-udp-src", log.Fields{"classifierInfo[UDP_SRC]": classifierInfo[UDPSrc].(uint32)})
-		} else if field.Type == utils.IPV4_DST {
+		} else if field.Type == flows.IPV4_DST {
 			classifierInfo[Ipv4Dst] = field.GetIpv4Dst()
 			log.Debug("field-type-ipv4-dst", log.Fields{"classifierInfo[IPV4_DST]": classifierInfo[Ipv4Dst].(uint32)})
-		} else if field.Type == utils.IPV4_SRC {
+		} else if field.Type == flows.IPV4_SRC {
 			classifierInfo[Ipv4Src] = field.GetIpv4Src()
 			log.Debug("field-type-ipv4-src", log.Fields{"classifierInfo[IPV4_SRC]": classifierInfo[Ipv4Src].(uint32)})
-		} else if field.Type == utils.METADATA {
+		} else if field.Type == flows.METADATA {
 			classifierInfo[Metadata] = field.GetTableMetadata()
 			log.Debug("field-type-metadata", log.Fields{"classifierInfo[Metadata]": classifierInfo[Metadata].(uint64)})
-		} else if field.Type == utils.TUNNEL_ID {
+		} else if field.Type == flows.TUNNEL_ID {
 			classifierInfo[TunnelID] = field.GetTunnelId()
 			log.Debug("field-type-tunnelId", log.Fields{"classifierInfo[TUNNEL_ID]": classifierInfo[TunnelID].(uint64)})
 		} else {
@@ -1694,8 +1694,8 @@
 }
 
 func formulateActionInfoFromFlow(actionInfo, classifierInfo map[string]interface{}, flow *ofp.OfpFlowStats) error {
-	for _, action := range utils.GetActions(flow) {
-		if action.Type == utils.OUTPUT {
+	for _, action := range flows.GetActions(flow) {
+		if action.Type == flows.OUTPUT {
 			if out := action.GetOutput(); out != nil {
 				actionInfo[Output] = out.GetPort()
 				log.Debugw("action-type-output", log.Fields{"out_port": actionInfo[Output].(uint32)})
@@ -1703,10 +1703,10 @@
 				log.Error("Invalid output port in action")
 				return errors.New("invalid output port in action")
 			}
-		} else if action.Type == utils.POP_VLAN {
+		} else if action.Type == flows.POP_VLAN {
 			actionInfo[PopVlan] = true
 			log.Debugw("action-type-pop-vlan", log.Fields{"in_port": classifierInfo[InPort].(uint32)})
-		} else if action.Type == utils.PUSH_VLAN {
+		} else if action.Type == flows.PUSH_VLAN {
 			if out := action.GetPush(); out != nil {
 				if tpid := out.GetEthertype(); tpid != 0x8100 {
 					log.Errorw("Invalid ethertype in push action", log.Fields{"ethertype": actionInfo[PushVlan].(int32)})
@@ -1717,7 +1717,7 @@
 						log.Fields{"push_tpid": actionInfo[TPID].(uint32), "in_port": classifierInfo[InPort].(uint32)})
 				}
 			}
-		} else if action.Type == utils.SET_FIELD {
+		} else if action.Type == flows.SET_FIELD {
 			if out := action.GetSetField(); out != nil {
 				if field := out.GetField(); field != nil {
 					if ofClass := field.GetOxmClass(); ofClass != ofp.OfpOxmClass_OFPXMC_OPENFLOW_BASIC {
@@ -1752,7 +1752,7 @@
 		log.Debug("Controller bound trap flows, getting inport from tunnelid")
 		/* Get UNI port/ IN Port from tunnel ID field for upstream controller bound flows  */
 		if portType := IntfIDToPortTypeName(classifierInfo[InPort].(uint32)); portType == voltha.Port_PON_OLT {
-			if uniPort := utils.GetChildPortFromTunnelId(flow); uniPort != 0 {
+			if uniPort := flows.GetChildPortFromTunnelId(flow); uniPort != 0 {
 				classifierInfo[InPort] = uniPort
 				log.Debugw("upstream pon-to-controller-flow,inport-in-tunnelid", log.Fields{"newInPort": classifierInfo[InPort].(uint32), "outPort": actionInfo[Output].(uint32)})
 			} else {
@@ -1764,7 +1764,7 @@
 		log.Debug("Non-Controller flows, getting uniport from tunnelid")
 		// Downstream flow from NNI to PON port , Use tunnel ID as new OUT port / UNI port
 		if portType := IntfIDToPortTypeName(actionInfo[Output].(uint32)); portType == voltha.Port_PON_OLT {
-			if uniPort := utils.GetChildPortFromTunnelId(flow); uniPort != 0 {
+			if uniPort := flows.GetChildPortFromTunnelId(flow); uniPort != 0 {
 				actionInfo[Output] = uniPort
 				log.Debugw("downstream-nni-to-pon-port-flow, outport-in-tunnelid", log.Fields{"newOutPort": actionInfo[Output].(uint32), "outPort": actionInfo[Output].(uint32)})
 			} else {
@@ -1773,7 +1773,7 @@
 			}
 			// Upstream flow from PON to NNI port , Use tunnel ID as new IN port / UNI port
 		} else if portType := IntfIDToPortTypeName(classifierInfo[InPort].(uint32)); portType == voltha.Port_PON_OLT {
-			if uniPort := utils.GetChildPortFromTunnelId(flow); uniPort != 0 {
+			if uniPort := flows.GetChildPortFromTunnelId(flow); uniPort != 0 {
 				classifierInfo[InPort] = uniPort
 				log.Debugw("upstream-pon-to-nni-port-flow, inport-in-tunnelid", log.Fields{"newInPort": actionInfo[Output].(uint32),
 					"outport": actionInfo[Output].(uint32)})
diff --git a/adaptercore/openolt_flowmgr_test.go b/adaptercore/openolt_flowmgr_test.go
index d730ec1..b76fef4 100644
--- a/adaptercore/openolt_flowmgr_test.go
+++ b/adaptercore/openolt_flowmgr_test.go
@@ -22,8 +22,8 @@
 
 	"github.com/opencord/voltha-protos/go/voltha"
 
-	fu "github.com/opencord/voltha-go/rw_core/utils"
 	"github.com/opencord/voltha-lib-go/pkg/db/model"
+	fu "github.com/opencord/voltha-lib-go/pkg/flows"
 	"github.com/opencord/voltha-lib-go/pkg/log"
 	tp "github.com/opencord/voltha-lib-go/pkg/techprofile"
 	"github.com/opencord/voltha-openolt-adapter/adaptercore/resourcemanager"
diff --git a/adaptercore/openolt_test.go b/adaptercore/openolt_test.go
index cf48cc3..91d8384 100644
--- a/adaptercore/openolt_test.go
+++ b/adaptercore/openolt_test.go
@@ -29,8 +29,8 @@
 	"sync"
 	"testing"
 
-	fu "github.com/opencord/voltha-go/rw_core/utils"
 	com "github.com/opencord/voltha-lib-go/pkg/adapters/common"
+	fu "github.com/opencord/voltha-lib-go/pkg/flows"
 	"github.com/opencord/voltha-lib-go/pkg/kafka"
 	ic "github.com/opencord/voltha-protos/go/inter_container"
 	"github.com/opencord/voltha-protos/go/openflow_13"
diff --git a/go.mod b/go.mod
index 557d98e..c302e8b 100644
--- a/go.mod
+++ b/go.mod
@@ -7,8 +7,7 @@
 	github.com/golang/protobuf v1.3.2
 	github.com/onsi/ginkgo v1.8.0 // indirect
 	github.com/onsi/gomega v1.5.0 // indirect
-	github.com/opencord/voltha-go v0.0.0-20191018170815-cb7c88a83125
-	github.com/opencord/voltha-lib-go v0.0.0-20191023185531-80258b36a64b
+	github.com/opencord/voltha-lib-go v0.0.0-20191024175357-456b893dc42c
 	github.com/opencord/voltha-protos v1.0.3
 	go.etcd.io/etcd v0.0.0-20190930204107-236ac2a90522
 	google.golang.org/grpc v1.24.0
diff --git a/go.sum b/go.sum
index ee454b9..c36f59d 100644
--- a/go.sum
+++ b/go.sum
@@ -15,7 +15,6 @@
 github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 h1:EFSB7Zo9Eg91v7MJPVsifUysc/wPdN+NOnVe6bWbdBM=
 github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
 github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
-github.com/bclicn/color v0.0.0-20180711051946-108f2023dc84/go.mod h1:Va9ap1qxjAWkIVaW1E9rH0aNgE8SDI5A4n8Ds8P0fAA=
 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
@@ -96,7 +95,6 @@
 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
 github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI=
 github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
-github.com/gyuho/goraph v0.0.0-20160328020532-d460590d53a9/go.mod h1:NtSxZCD+s3sZFwbW6WceOcUD83HM9XD5OE2r4c0P8eg=
 github.com/hashicorp/consul/api v1.2.0 h1:oPsuzLp2uk7I7rojPKuncWbZ+m5TMoD4Ivs+2Rkeh4Y=
 github.com/hashicorp/consul/api v1.2.0/go.mod h1:1SIkFYi2ZTXUE5Kgt179+4hH33djo11+0Eo2XgTAtkw=
 github.com/hashicorp/consul/sdk v0.2.0 h1:GWFYFmry/k4b1hEoy7kSkmU8e30GAyI4VZHk0fRxeL4=
@@ -192,12 +190,8 @@
 github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
 github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
 github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/opencord/voltha-go v0.0.0-20191018170815-cb7c88a83125 h1:yl7OfFs9vdIvWTA3S/NjNPOYaMmbZofYeWNTTRn1TfU=
-github.com/opencord/voltha-go v0.0.0-20191018170815-cb7c88a83125/go.mod h1:98NCXBPUxv60BA5dkLBwDSfsE9vbxORz2mACL1WlDB0=
-github.com/opencord/voltha-lib-go v0.0.0-20191017201200-e73f91e306e9 h1:/CA9esQ/L41vhvwCIDI+cLjrawry5+1fQWt/O91KFXU=
-github.com/opencord/voltha-lib-go v0.0.0-20191017201200-e73f91e306e9/go.mod h1:+bjwfm5bbP1j6liscpn3UFqbh6hHDkmLDWU3AdYLDY4=
-github.com/opencord/voltha-lib-go v0.0.0-20191023185531-80258b36a64b h1:s3zvCa27RhpVy+wCk5R4iKa9H61B1MzbSL2164B1w68=
-github.com/opencord/voltha-lib-go v0.0.0-20191023185531-80258b36a64b/go.mod h1:+bjwfm5bbP1j6liscpn3UFqbh6hHDkmLDWU3AdYLDY4=
+github.com/opencord/voltha-lib-go v0.0.0-20191024175357-456b893dc42c h1:+8iex9a0qDyuNqCXfy2SBHOK0Cfiev38RhQqkIitpew=
+github.com/opencord/voltha-lib-go v0.0.0-20191024175357-456b893dc42c/go.mod h1:VDb+kLjSvAm4iaArzXB143fug199CG0/wv+Bseh1mcM=
 github.com/opencord/voltha-protos v1.0.3 h1:9v+R/QGF1xK+HKTqFM0IqCABoGCAxC8iKH4VzNBJDto=
 github.com/opencord/voltha-protos v1.0.3/go.mod h1:myfFIkJdA+rCXmKdLImhh79MfabN4ZOKQ4grk32DnPQ=
 github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
diff --git a/vendor/github.com/opencord/voltha-go/rw_core/utils/core_utils.go b/vendor/github.com/opencord/voltha-go/rw_core/utils/core_utils.go
deleted file mode 100644
index aad1348..0000000
--- a/vendor/github.com/opencord/voltha-go/rw_core/utils/core_utils.go
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2018-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package utils
-
-import (
-	"google.golang.org/grpc/codes"
-	"google.golang.org/grpc/status"
-	"os"
-	"reflect"
-	"time"
-)
-
-type DeviceID struct {
-	Id string
-}
-
-type LogicalDeviceID struct {
-	Id string
-}
-
-func GetHostName() string {
-	return os.Getenv("HOSTNAME")
-}
-
-//WaitForNilOrErrorResponses waits on a variadic number of channels for either a nil response or an error
-//response. If an error is received from a given channel then the returned error array will contain that error.
-//The error will be at the index corresponding to the order in which the channel appear in the parameter list.
-//If no errors is found then nil is returned.  This method also takes in a timeout in milliseconds. If a
-//timeout is obtained then this function will stop waiting for the remaining responses and abort.
-func WaitForNilOrErrorResponses(timeout int64, chnls ...chan interface{}) []error {
-	if len(chnls) == 0 {
-		return nil
-	}
-	// Create a timeout channel
-	tChnl := make(chan *interface{})
-	go func() {
-		time.Sleep(time.Duration(timeout) * time.Millisecond)
-		tChnl <- nil
-	}()
-
-	errorsReceived := false
-	errors := make([]error, len(chnls))
-	cases := make([]reflect.SelectCase, len(chnls)+1)
-	for i, ch := range chnls {
-		cases[i] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(ch)}
-	}
-	// Add the timeout channel
-	cases[len(chnls)] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(tChnl)}
-
-	resultsReceived := make([]bool, len(errors)+1)
-	remaining := len(cases) - 1
-	for remaining > 0 {
-		index, value, ok := reflect.Select(cases)
-		if !ok { // closed channel
-			//Set the channel at that index to nil to disable this case, hence preventing it from interfering with other cases.
-			cases[index].Chan = reflect.ValueOf(nil)
-			errors[index] = status.Error(codes.Internal, "channel closed")
-			errorsReceived = true
-		} else if index == len(chnls) { // Timeout has occurred
-			for k := range errors {
-				if !resultsReceived[k] {
-					errors[k] = status.Error(codes.Aborted, "timeout")
-				}
-			}
-			errorsReceived = true
-			break
-		} else if value.IsNil() { // Nil means a good response
-			//do nothing
-		} else if err, ok := value.Interface().(error); ok { // error returned
-			errors[index] = err
-			errorsReceived = true
-		} else { // unknown value
-			errors[index] = status.Errorf(codes.Internal, "%s", value)
-			errorsReceived = true
-		}
-		resultsReceived[index] = true
-		remaining -= 1
-	}
-
-	if errorsReceived {
-		return errors
-	}
-	return nil
-}
diff --git a/vendor/github.com/opencord/voltha-go/rw_core/utils/flow_utils.go b/vendor/github.com/opencord/voltha-lib-go/pkg/flows/flow_utils.go
similarity index 98%
rename from vendor/github.com/opencord/voltha-go/rw_core/utils/flow_utils.go
rename to vendor/github.com/opencord/voltha-lib-go/pkg/flows/flow_utils.go
index 7ead52d..2dbf52d 100644
--- a/vendor/github.com/opencord/voltha-go/rw_core/utils/flow_utils.go
+++ b/vendor/github.com/opencord/voltha-lib-go/pkg/flows/flow_utils.go
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package utils
+package flows
 
 import (
 	"bytes"
@@ -474,6 +474,20 @@
 	return 0
 }
 
+func GetVlanVid(flow *ofp.OfpFlowStats) *uint32 {
+	if flow == nil {
+		return nil
+	}
+	for _, field := range GetOfbFields(flow) {
+		if field.Type == VLAN_VID {
+			ret := field.GetVlanVid()
+			return &ret
+		}
+	}
+	// Dont return 0 if the field is missing as vlan id value 0 has meaning and cannot be overloaded as "not found"
+	return nil
+}
+
 func GetTunnelId(flow *ofp.OfpFlowStats) uint64 {
 	if flow == nil {
 		return 0
diff --git a/vendor/modules.txt b/vendor/modules.txt
index ff0f299..6aa9bf6 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -60,9 +60,7 @@
 github.com/mitchellh/go-homedir
 # github.com/mitchellh/mapstructure v1.1.2
 github.com/mitchellh/mapstructure
-# github.com/opencord/voltha-go v0.0.0-20191018170815-cb7c88a83125
-github.com/opencord/voltha-go/rw_core/utils
-# github.com/opencord/voltha-lib-go v0.0.0-20191023185531-80258b36a64b
+# github.com/opencord/voltha-lib-go v0.0.0-20191024175357-456b893dc42c
 github.com/opencord/voltha-lib-go/pkg/adapters
 github.com/opencord/voltha-lib-go/pkg/adapters/adapterif
 github.com/opencord/voltha-lib-go/pkg/adapters/common
@@ -70,6 +68,7 @@
 github.com/opencord/voltha-lib-go/pkg/kafka
 github.com/opencord/voltha-lib-go/pkg/log
 github.com/opencord/voltha-lib-go/pkg/probe
+github.com/opencord/voltha-lib-go/pkg/flows
 github.com/opencord/voltha-lib-go/pkg/techprofile
 github.com/opencord/voltha-lib-go/pkg/db/model
 github.com/opencord/voltha-lib-go/pkg/ponresourcemanager