diff --git a/vendor/github.com/golang/protobuf/descriptor/descriptor.go b/vendor/github.com/golang/protobuf/descriptor/descriptor.go
deleted file mode 100644
index ac7e51b..0000000
--- a/vendor/github.com/golang/protobuf/descriptor/descriptor.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors.  All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Package descriptor provides functions for obtaining protocol buffer
-// descriptors for generated Go types.
-//
-// These functions cannot go in package proto because they depend on the
-// generated protobuf descriptor messages, which themselves depend on proto.
-package descriptor
-
-import (
-	"bytes"
-	"compress/gzip"
-	"fmt"
-	"io/ioutil"
-
-	"github.com/golang/protobuf/proto"
-	protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
-)
-
-// extractFile extracts a FileDescriptorProto from a gzip'd buffer.
-func extractFile(gz []byte) (*protobuf.FileDescriptorProto, error) {
-	r, err := gzip.NewReader(bytes.NewReader(gz))
-	if err != nil {
-		return nil, fmt.Errorf("failed to open gzip reader: %v", err)
-	}
-	defer r.Close()
-
-	b, err := ioutil.ReadAll(r)
-	if err != nil {
-		return nil, fmt.Errorf("failed to uncompress descriptor: %v", err)
-	}
-
-	fd := new(protobuf.FileDescriptorProto)
-	if err := proto.Unmarshal(b, fd); err != nil {
-		return nil, fmt.Errorf("malformed FileDescriptorProto: %v", err)
-	}
-
-	return fd, nil
-}
-
-// Message is a proto.Message with a method to return its descriptor.
-//
-// Message types generated by the protocol compiler always satisfy
-// the Message interface.
-type Message interface {
-	proto.Message
-	Descriptor() ([]byte, []int)
-}
-
-// ForMessage returns a FileDescriptorProto and a DescriptorProto from within it
-// describing the given message.
-func ForMessage(msg Message) (fd *protobuf.FileDescriptorProto, md *protobuf.DescriptorProto) {
-	gz, path := msg.Descriptor()
-	fd, err := extractFile(gz)
-	if err != nil {
-		panic(fmt.Sprintf("invalid FileDescriptorProto for %T: %v", msg, err))
-	}
-
-	md = fd.MessageType[path[0]]
-	for _, i := range path[1:] {
-		md = md.NestedType[i]
-	}
-	return fd, md
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/backend.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/backend.go
similarity index 78%
rename from vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/backend.go
rename to vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/backend.go
index f5ead88..c319d99 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/backend.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/backend.go
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package model
+package db
 
 import (
 	"errors"
@@ -23,13 +23,8 @@
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	"strconv"
 	"sync"
-	"time"
 )
 
-//TODO: missing cache stuff
-//TODO: missing retry stuff
-//TODO: missing proper logging
-
 // Backend structure holds details for accessing the kv store
 type Backend struct {
 	sync.RWMutex
@@ -82,53 +77,47 @@
 }
 
 // List retrieves one or more items that match the specified key
-func (b *Backend) List(key string, lock ...bool) (map[string]*kvstore.KVPair, error) {
+func (b *Backend) List(key string) (map[string]*kvstore.KVPair, error) {
 	b.Lock()
 	defer b.Unlock()
 
 	formattedPath := b.makePath(key)
-	log.Debugw("listing-key", log.Fields{"key": key, "path": formattedPath, "lock": lock})
+	log.Debugw("listing-key", log.Fields{"key": key, "path": formattedPath})
 
-	return b.Client.List(formattedPath, b.Timeout, lock...)
+	return b.Client.List(formattedPath, b.Timeout)
 }
 
 // Get retrieves an item that matches the specified key
-func (b *Backend) Get(key string, lock ...bool) (*kvstore.KVPair, error) {
+func (b *Backend) Get(key string) (*kvstore.KVPair, error) {
 	b.Lock()
 	defer b.Unlock()
 
 	formattedPath := b.makePath(key)
-	log.Debugw("getting-key", log.Fields{"key": key, "path": formattedPath, "lock": lock})
+	log.Debugw("getting-key", log.Fields{"key": key, "path": formattedPath})
 
-	start := time.Now()
-	err, pair := b.Client.Get(formattedPath, b.Timeout, lock...)
-	stop := time.Now()
-
-	GetProfiling().AddToDatabaseRetrieveTime(stop.Sub(start).Seconds())
-
-	return err, pair
+	return b.Client.Get(formattedPath, b.Timeout)
 }
 
 // Put stores an item value under the specifed key
-func (b *Backend) Put(key string, value interface{}, lock ...bool) error {
+func (b *Backend) Put(key string, value interface{}) error {
 	b.Lock()
 	defer b.Unlock()
 
 	formattedPath := b.makePath(key)
-	log.Debugw("putting-key", log.Fields{"key": key, "value": string(value.([]byte)), "path": formattedPath, "lock": lock})
+	log.Debugw("putting-key", log.Fields{"key": key, "value": string(value.([]byte)), "path": formattedPath})
 
-	return b.Client.Put(formattedPath, value, b.Timeout, lock...)
+	return b.Client.Put(formattedPath, value, b.Timeout)
 }
 
 // Delete removes an item under the specified key
-func (b *Backend) Delete(key string, lock ...bool) error {
+func (b *Backend) Delete(key string) error {
 	b.Lock()
 	defer b.Unlock()
 
 	formattedPath := b.makePath(key)
-	log.Debugw("deleting-key", log.Fields{"key": key, "path": formattedPath, "lock": lock})
+	log.Debugw("deleting-key", log.Fields{"key": key, "path": formattedPath})
 
-	return b.Client.Delete(formattedPath, b.Timeout, lock...)
+	return b.Client.Delete(formattedPath, b.Timeout)
 }
 
 // CreateWatch starts watching events for the specified key
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/client.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/client.go
index c0ebe5f..97fbec9 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/client.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/client.go
@@ -79,10 +79,10 @@
 
 // Client represents the set of APIs a KV Client must implement
 type Client interface {
-	List(key string, timeout int, lock ...bool) (map[string]*KVPair, error)
-	Get(key string, timeout int, lock ...bool) (*KVPair, error)
-	Put(key string, value interface{}, timeout int, lock ...bool) error
-	Delete(key string, timeout int, lock ...bool) error
+	List(key string, timeout int) (map[string]*KVPair, error)
+	Get(key string, timeout int) (*KVPair, error)
+	Put(key string, value interface{}, timeout int) error
+	Delete(key string, timeout int) error
 	Reserve(key string, value interface{}, ttl int64) (interface{}, error)
 	ReleaseReservation(key string) error
 	ReleaseAllReservations() error
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/consulclient.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/consulclient.go
index e0e8550..a94de4d 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/consulclient.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/consulclient.go
@@ -71,7 +71,7 @@
 
 // List returns an array of key-value pairs with key as a prefix.  Timeout defines how long the function will
 // wait for a response
-func (c *ConsulClient) List(key string, timeout int, lock ...bool) (map[string]*KVPair, error) {
+func (c *ConsulClient) List(key string, timeout int) (map[string]*KVPair, error) {
 	duration := GetDuration(timeout)
 
 	kv := c.consul.KV()
@@ -92,7 +92,7 @@
 
 // Get returns a key-value pair for a given key. Timeout defines how long the function will
 // wait for a response
-func (c *ConsulClient) Get(key string, timeout int, lock ...bool) (*KVPair, error) {
+func (c *ConsulClient) Get(key string, timeout int) (*KVPair, error) {
 
 	duration := GetDuration(timeout)
 
@@ -115,7 +115,7 @@
 // Put writes a key-value pair to the KV store.  Value can only be a string or []byte since the consul API
 // accepts only a []byte as a value for a put operation. Timeout defines how long the function will
 // wait for a response
-func (c *ConsulClient) Put(key string, value interface{}, timeout int, lock ...bool) error {
+func (c *ConsulClient) Put(key string, value interface{}, timeout int) error {
 
 	// Validate that we can create a byte array from the value as consul API expects a byte array
 	var val []byte
@@ -141,7 +141,7 @@
 
 // Delete removes a key from the KV store. Timeout defines how long the function will
 // wait for a response
-func (c *ConsulClient) Delete(key string, timeout int, lock ...bool) error {
+func (c *ConsulClient) Delete(key string, timeout int) error {
 	kv := c.consul.KV()
 	var writeOptions consulapi.WriteOptions
 	c.writeLock.Lock()
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/etcdclient.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/etcdclient.go
index 8db047c..e8bc92c 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/etcdclient.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore/etcdclient.go
@@ -71,7 +71,7 @@
 
 // List returns an array of key-value pairs with key as a prefix.  Timeout defines how long the function will
 // wait for a response
-func (c *EtcdClient) List(key string, timeout int, lock ...bool) (map[string]*KVPair, error) {
+func (c *EtcdClient) List(key string, timeout int) (map[string]*KVPair, error) {
 	duration := GetDuration(timeout)
 
 	ctx, cancel := context.WithTimeout(context.Background(), duration)
@@ -91,7 +91,7 @@
 
 // Get returns a key-value pair for a given key. Timeout defines how long the function will
 // wait for a response
-func (c *EtcdClient) Get(key string, timeout int, lock ...bool) (*KVPair, error) {
+func (c *EtcdClient) Get(key string, timeout int) (*KVPair, error) {
 	duration := GetDuration(timeout)
 
 	ctx, cancel := context.WithTimeout(context.Background(), duration)
@@ -112,7 +112,7 @@
 // Put writes a key-value pair to the KV store.  Value can only be a string or []byte since the etcd API
 // accepts only a string as a value for a put operation. Timeout defines how long the function will
 // wait for a response
-func (c *EtcdClient) Put(key string, value interface{}, timeout int, lock ...bool) error {
+func (c *EtcdClient) Put(key string, value interface{}, timeout int) error {
 
 	// Validate that we can convert value to a string as etcd API expects a string
 	var val string
@@ -155,7 +155,7 @@
 
 // Delete removes a key from the KV store. Timeout defines how long the function will
 // wait for a response
-func (c *EtcdClient) Delete(key string, timeout int, lock ...bool) error {
+func (c *EtcdClient) Delete(key string, timeout int) error {
 
 	duration := GetDuration(timeout)
 
@@ -233,7 +233,7 @@
 		}
 	} else {
 		// Read the Key to ensure this is our Key
-		m, err := c.Get(key, defaultKVGetTimeout, false)
+		m, err := c.Get(key, defaultKVGetTimeout)
 		if err != nil {
 			return nil, err
 		}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/branch.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/branch.go
deleted file mode 100644
index 957e0ca..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/branch.go
+++ /dev/null
@@ -1,171 +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 model
-
-import (
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"sync"
-)
-
-// TODO: implement weak references or something equivalent
-// TODO: missing proper logging
-
-// Branch structure is used to classify a collection of transaction based revisions
-type Branch struct {
-	mutex      sync.RWMutex
-	Node       *node
-	Txid       string
-	Origin     Revision
-	Revisions  map[string]Revision
-	LatestLock sync.RWMutex
-	Latest     Revision
-}
-
-// NewBranch creates a new instance of the Branch structure
-func NewBranch(node *node, txid string, origin Revision, autoPrune bool) *Branch {
-	b := &Branch{}
-	b.Node = node
-	b.Txid = txid
-	b.Origin = origin
-	b.Revisions = make(map[string]Revision)
-	b.Latest = origin
-
-	return b
-}
-
-// Utility function to extract all children names for a given revision (mostly for debugging purposes)
-func (b *Branch) retrieveChildrenNames(revision Revision) []string {
-	var childrenNames []string
-
-	for _, child := range revision.GetChildren("devices") {
-		childrenNames = append(childrenNames, child.GetName())
-	}
-
-	return childrenNames
-}
-
-// Utility function to compare children names and report the missing ones (mostly for debugging purposes)
-func (b *Branch) findMissingChildrenNames(previousNames, latestNames []string) []string {
-	var missingNames []string
-
-	for _, previousName := range previousNames {
-		found := false
-
-		if len(latestNames) == 0 {
-			break
-		}
-
-		for _, latestName := range latestNames {
-			if previousName == latestName {
-				found = true
-				break
-			}
-		}
-		if !found {
-			missingNames = append(missingNames, previousName)
-		}
-	}
-
-	return missingNames
-}
-
-// SetLatest assigns the latest revision for this branch
-func (b *Branch) SetLatest(latest Revision) {
-	b.mutex.Lock()
-	defer b.mutex.Unlock()
-
-	if b.Latest != nil {
-		log.Debugw("updating-latest-revision", log.Fields{"current": b.Latest.GetHash(), "new": latest.GetHash()})
-
-		// Go through list of children names in current revision and new revision
-		// and then compare the resulting outputs to ensure that we have not lost any entries.
-
-		if level, _ := log.GetPackageLogLevel(); level == log.DebugLevel {
-			var previousNames, latestNames, missingNames []string
-
-			if previousNames = b.retrieveChildrenNames(b.Latest); len(previousNames) > 0 {
-				log.Debugw("children-of-previous-revision", log.Fields{"hash": b.Latest.GetHash(), "names": previousNames})
-			}
-
-			if latestNames = b.retrieveChildrenNames(b.Latest); len(latestNames) > 0 {
-				log.Debugw("children-of-latest-revision", log.Fields{"hash": latest.GetHash(), "names": latestNames})
-			}
-
-			if missingNames = b.findMissingChildrenNames(previousNames, latestNames); len(missingNames) > 0 {
-				log.Debugw("children-missing-in-latest-revision", log.Fields{"hash": latest.GetHash(), "names": missingNames})
-			}
-		}
-
-	} else {
-		log.Debugw("setting-latest-revision", log.Fields{"new": latest.GetHash()})
-	}
-
-	b.Latest = latest
-}
-
-// GetLatest retrieves the latest revision of the branch
-func (b *Branch) GetLatest() Revision {
-	b.mutex.RLock()
-	defer b.mutex.RUnlock()
-
-	return b.Latest
-}
-
-// GetOrigin retrieves the original revision of the branch
-func (b *Branch) GetOrigin() Revision {
-	b.mutex.RLock()
-	defer b.mutex.RUnlock()
-
-	return b.Origin
-}
-
-// AddRevision inserts a new revision to the branch
-func (b *Branch) AddRevision(revision Revision) {
-	if revision != nil && b.GetRevision(revision.GetHash()) == nil {
-		b.SetRevision(revision.GetHash(), revision)
-	}
-}
-
-// GetRevision pulls a revision entry at the specified hash
-func (b *Branch) GetRevision(hash string) Revision {
-	b.mutex.RLock()
-	defer b.mutex.RUnlock()
-
-	if revision, ok := b.Revisions[hash]; ok {
-		return revision
-	}
-
-	return nil
-}
-
-// SetRevision updates a revision entry at the specified hash
-func (b *Branch) SetRevision(hash string, revision Revision) {
-	b.mutex.Lock()
-	defer b.mutex.Unlock()
-
-	b.Revisions[hash] = revision
-}
-
-// DeleteRevision removes a revision with the specified hash
-func (b *Branch) DeleteRevision(hash string) {
-	b.mutex.Lock()
-	defer b.mutex.Unlock()
-
-	if _, ok := b.Revisions[hash]; ok {
-		delete(b.Revisions, hash)
-	}
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/callback_type.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/callback_type.go
deleted file mode 100644
index b530dee..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/callback_type.go
+++ /dev/null
@@ -1,47 +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 model
-
-// CallbackType is an enumerated value to express when a callback should be executed
-type CallbackType uint8
-
-// Enumerated list of callback types
-const (
-	GET CallbackType = iota
-	PRE_UPDATE
-	POST_UPDATE
-	PRE_ADD
-	POST_ADD
-	PRE_REMOVE
-	POST_REMOVE
-	POST_LISTCHANGE
-)
-
-var enumCallbackTypes = []string{
-	"GET",
-	"PRE_UPDATE",
-	"POST_UPDATE",
-	"PRE_ADD",
-	"POST_ADD",
-	"PRE_REMOVE",
-	"POST_REMOVE",
-	"POST_LISTCHANGE",
-}
-
-func (t CallbackType) String() string {
-	return enumCallbackTypes[t]
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/child_type.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/child_type.go
deleted file mode 100644
index 5928192..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/child_type.go
+++ /dev/null
@@ -1,169 +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 model
-
-import (
-	desc "github.com/golang/protobuf/descriptor"
-	"github.com/golang/protobuf/proto"
-	"github.com/golang/protobuf/protoc-gen-go/descriptor"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"github.com/opencord/voltha-protos/v2/go/common"
-	"reflect"
-	"strconv"
-	"sync"
-)
-
-type childTypesSingleton struct {
-	mutex sync.RWMutex
-	Cache map[interface{}]map[string]*ChildType
-}
-
-var instanceChildTypes *childTypesSingleton
-var onceChildTypes sync.Once
-
-func getChildTypes() *childTypesSingleton {
-	onceChildTypes.Do(func() {
-		instanceChildTypes = &childTypesSingleton{}
-	})
-	return instanceChildTypes
-}
-
-func (s *childTypesSingleton) GetCache() map[interface{}]map[string]*ChildType {
-	s.mutex.RLock()
-	defer s.mutex.RUnlock()
-	return s.Cache
-}
-
-func (s *childTypesSingleton) SetCache(cache map[interface{}]map[string]*ChildType) {
-	s.mutex.Lock()
-	defer s.mutex.Unlock()
-	s.Cache = cache
-}
-
-func (s *childTypesSingleton) GetCacheEntry(key interface{}) (map[string]*ChildType, bool) {
-	s.mutex.RLock()
-	defer s.mutex.RUnlock()
-	childTypeMap, exists := s.Cache[key]
-	return childTypeMap, exists
-}
-
-func (s *childTypesSingleton) SetCacheEntry(key interface{}, value map[string]*ChildType) {
-	s.mutex.Lock()
-	defer s.mutex.Unlock()
-	s.Cache[key] = value
-}
-
-func (s *childTypesSingleton) ResetCache() {
-	s.mutex.Lock()
-	defer s.mutex.Unlock()
-	s.Cache = make(map[interface{}]map[string]*ChildType)
-}
-
-// ChildType structure contains construct details of an object
-type ChildType struct {
-	ClassModule string
-	ClassType   reflect.Type
-	IsContainer bool
-	Key         string
-	KeyFromStr  func(s string) interface{}
-}
-
-// ChildrenFields retrieves list of child objects associated to a given interface
-func ChildrenFields(cls interface{}) map[string]*ChildType {
-	if cls == nil {
-		return nil
-	}
-	var names map[string]*ChildType
-	var namesExist bool
-
-	if getChildTypes().Cache == nil {
-		getChildTypes().Cache = make(map[interface{}]map[string]*ChildType)
-	}
-
-	msgType := reflect.TypeOf(cls)
-	inst := getChildTypes()
-
-	if names, namesExist = inst.Cache[msgType.String()]; !namesExist {
-		names = make(map[string]*ChildType)
-
-		_, md := desc.ForMessage(cls.(desc.Message))
-
-		// TODO: Do we need to validate MD for nil, panic or exception?
-		for _, field := range md.Field {
-			if options := field.GetOptions(); options != nil {
-				if proto.HasExtension(options, common.E_ChildNode) {
-					isContainer := *field.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED
-					meta, _ := proto.GetExtension(options, common.E_ChildNode)
-
-					var keyFromStr func(string) interface{}
-					var ct ChildType
-
-					parentType := FindOwnerType(reflect.ValueOf(cls), field.GetName(), 0, false)
-					if meta.(*common.ChildNode).GetKey() != "" {
-						keyType := FindKeyOwner(reflect.New(parentType).Elem().Interface(), meta.(*common.ChildNode).GetKey(), 0)
-
-						switch keyType.(reflect.Type).Name() {
-						case "string":
-							keyFromStr = func(s string) interface{} {
-								return s
-							}
-						case "int32":
-							keyFromStr = func(s string) interface{} {
-								i, _ := strconv.Atoi(s)
-								return int32(i)
-							}
-						case "int64":
-							keyFromStr = func(s string) interface{} {
-								i, _ := strconv.Atoi(s)
-								return int64(i)
-							}
-						case "uint32":
-							keyFromStr = func(s string) interface{} {
-								i, _ := strconv.Atoi(s)
-								return uint32(i)
-							}
-						case "uint64":
-							keyFromStr = func(s string) interface{} {
-								i, _ := strconv.Atoi(s)
-								return uint64(i)
-							}
-						default:
-							log.Errorf("Key type not implemented - type: %s\n", keyType.(reflect.Type))
-						}
-					}
-
-					ct = ChildType{
-						ClassModule: parentType.String(),
-						ClassType:   parentType,
-						IsContainer: isContainer,
-						Key:         meta.(*common.ChildNode).GetKey(),
-						KeyFromStr:  keyFromStr,
-					}
-
-					names[field.GetName()] = &ct
-				}
-			}
-		}
-
-		getChildTypes().Cache[msgType.String()] = names
-	} else {
-		entry, _ := inst.GetCacheEntry(msgType.String())
-		log.Debugf("Cache entry for %s: %+v", msgType.String(), entry)
-	}
-
-	return names
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/data_revision.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/data_revision.go
deleted file mode 100644
index 35f5958..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/data_revision.go
+++ /dev/null
@@ -1,73 +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 model
-
-import (
-	"bytes"
-	"crypto/md5"
-	"encoding/json"
-	"fmt"
-	"github.com/golang/protobuf/proto"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"reflect"
-)
-
-// DataRevision stores the data associated to a revision along with its calculated checksum hash value
-type DataRevision struct {
-	Data interface{}
-	Hash string
-}
-
-// NewDataRevision creates a new instance of a DataRevision structure
-func NewDataRevision(root *root, data interface{}) *DataRevision {
-	dr := DataRevision{}
-	dr.Data = data
-	dr.Hash = dr.hashData(root, data)
-
-	return &dr
-}
-
-func (dr *DataRevision) hashData(root *root, data interface{}) string {
-	var buffer bytes.Buffer
-
-	if IsProtoMessage(data) {
-		if pbdata, err := proto.Marshal(data.(proto.Message)); err != nil {
-			log.Debugf("problem to marshal protobuf data --> err: %s", err.Error())
-		} else {
-			buffer.Write(pbdata)
-			// To ensure uniqueness in case data is nil, also include data type
-			buffer.Write([]byte(reflect.TypeOf(data).String()))
-		}
-
-	} else if reflect.ValueOf(data).IsValid() {
-		dataObj := reflect.New(reflect.TypeOf(data).Elem())
-		if json, err := json.Marshal(dataObj.Interface()); err != nil {
-			log.Debugf("problem to marshal data --> err: %s", err.Error())
-		} else {
-			buffer.Write(json)
-		}
-	} else {
-		dataObj := reflect.New(reflect.TypeOf(data).Elem())
-		buffer.Write(dataObj.Bytes())
-	}
-
-	// Add the root pointer that owns the current data for extra uniqueness
-	rootPtr := fmt.Sprintf("%p", root)
-	buffer.Write([]byte(rootPtr))
-
-	return fmt.Sprintf("%x", md5.Sum(buffer.Bytes()))[:12]
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/event_bus.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/event_bus.go
deleted file mode 100644
index d0a21f1..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/event_bus.go
+++ /dev/null
@@ -1,94 +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 model
-
-import (
-	"encoding/json"
-	"github.com/golang/protobuf/proto"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"github.com/opencord/voltha-protos/v2/go/voltha"
-)
-
-// EventBus contains the details required to communicate with the event bus mechanism
-type EventBus struct {
-	client *EventBusClient
-	topic  string
-}
-
-// ignoredCallbacks keeps a list of callbacks that should not be advertised on the event bus
-var (
-	ignoredCallbacks = map[CallbackType]struct{}{
-		PRE_ADD:         {},
-		GET:             {},
-		POST_LISTCHANGE: {},
-		PRE_REMOVE:      {},
-		PRE_UPDATE:      {},
-	}
-)
-
-// NewEventBus creates a new instance of the EventBus structure
-func NewEventBus() *EventBus {
-	bus := &EventBus{
-		client: NewEventBusClient(),
-		topic:  "model-change-events",
-	}
-	return bus
-}
-
-// Advertise will publish the provided information to the event bus
-func (bus *EventBus) Advertise(args ...interface{}) interface{} {
-	eventType := args[0].(CallbackType)
-	hash := args[1].(string)
-	data := args[2:]
-
-	if _, ok := ignoredCallbacks[eventType]; ok {
-		log.Debugf("ignoring event - type:%s, data:%+v", eventType, data)
-	}
-	var kind voltha.ConfigEventType_ConfigEventType
-	switch eventType {
-	case POST_ADD:
-		kind = voltha.ConfigEventType_add
-	case POST_REMOVE:
-		kind = voltha.ConfigEventType_remove
-	default:
-		kind = voltha.ConfigEventType_update
-	}
-
-	var msg []byte
-	var err error
-	if IsProtoMessage(data) {
-		if msg, err = proto.Marshal(data[0].(proto.Message)); err != nil {
-			log.Debugf("problem marshalling proto data: %+v, err:%s", data[0], err.Error())
-		}
-	} else if data[0] != nil {
-		if msg, err = json.Marshal(data[0]); err != nil {
-			log.Debugf("problem marshalling json data: %+v, err:%s", data[0], err.Error())
-		}
-	} else {
-		log.Debugf("no data to advertise : %+v", data[0])
-	}
-
-	event := voltha.ConfigEvent{
-		Type: kind,
-		Hash: hash,
-		Data: string(msg),
-	}
-
-	bus.client.Publish(bus.topic, event)
-
-	return nil
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/event_bus_client.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/event_bus_client.go
deleted file mode 100644
index d9a8d49..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/event_bus_client.go
+++ /dev/null
@@ -1,36 +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 model
-
-import (
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"github.com/opencord/voltha-protos/v2/go/voltha"
-)
-
-// EventBusClient is an abstraction layer structure to communicate with an event bus mechanism
-type EventBusClient struct {
-}
-
-// NewEventBusClient creates a new EventBusClient instance
-func NewEventBusClient() *EventBusClient {
-	return &EventBusClient{}
-}
-
-// Publish sends a event to the bus
-func (ebc *EventBusClient) Publish(topic string, event voltha.ConfigEvent) {
-	log.Debugf("publishing event:%+v, topic:%s\n", event, topic)
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/merge.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/merge.go
deleted file mode 100644
index 07ae9b9..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/merge.go
+++ /dev/null
@@ -1,273 +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 model
-
-import (
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-)
-
-func revisionsAreEqual(a, b []Revision) bool {
-	// If one is nil, the other must also be nil.
-	if (a == nil) != (b == nil) {
-		return false
-	}
-
-	if len(a) != len(b) {
-		return false
-	}
-
-	for i := range a {
-		if a[i] != b[i] {
-			return false
-		}
-	}
-
-	return true
-}
-
-type changeAnalysis struct {
-	KeyMap1     map[string]int
-	KeyMap2     map[string]int
-	AddedKeys   map[string]struct{}
-	RemovedKeys map[string]struct{}
-	ChangedKeys map[string]struct{}
-}
-
-func newChangeAnalysis(lst1, lst2 []Revision, keyName string) *changeAnalysis {
-	changes := &changeAnalysis{}
-
-	changes.KeyMap1 = make(map[string]int)
-	changes.KeyMap2 = make(map[string]int)
-
-	changes.AddedKeys = make(map[string]struct{})
-	changes.RemovedKeys = make(map[string]struct{})
-	changes.ChangedKeys = make(map[string]struct{})
-
-	for i, rev := range lst1 {
-		_, v := GetAttributeValue(rev.GetData(), keyName, 0)
-		changes.KeyMap1[v.String()] = i
-	}
-	for i, rev := range lst2 {
-		_, v := GetAttributeValue(rev.GetData(), keyName, 0)
-		changes.KeyMap2[v.String()] = i
-	}
-	for v := range changes.KeyMap2 {
-		if _, ok := changes.KeyMap1[v]; !ok {
-			changes.AddedKeys[v] = struct{}{}
-		}
-	}
-	for v := range changes.KeyMap1 {
-		if _, ok := changes.KeyMap2[v]; !ok {
-			changes.RemovedKeys[v] = struct{}{}
-		}
-	}
-	for v := range changes.KeyMap1 {
-		if _, ok := changes.KeyMap2[v]; ok && lst1[changes.KeyMap1[v]].GetHash() != lst2[changes.KeyMap2[v]].GetHash() {
-			changes.ChangedKeys[v] = struct{}{}
-		}
-	}
-
-	return changes
-}
-
-// Merge3Way takes care of combining the revision contents of the same data set
-func Merge3Way(
-	forkRev, srcRev, dstRev Revision,
-	mergeChildFunc func(Revision) Revision,
-	dryRun bool) (rev Revision, changes []ChangeTuple) {
-
-	log.Debugw("3-way-merge-request", log.Fields{"dryRun": dryRun})
-
-	var configChanged bool
-	var revsToDiscard []Revision
-
-	if dstRev.GetConfig() == forkRev.GetConfig() {
-		configChanged = dstRev.GetConfig() != srcRev.GetConfig()
-	} else {
-		if dstRev.GetConfig().Hash != srcRev.GetConfig().Hash {
-			log.Error("config-collision")
-		}
-		configChanged = true
-	}
-
-	//newChildren := reflect.ValueOf(dstRev.GetAllChildren()).Interface().(map[string][]Revision)
-	newChildren := make(map[string][]Revision)
-	for entryName, childrenEntry := range dstRev.GetAllChildren() {
-		//newRev.Children[entryName] = append(newRev.Children[entryName], childrenEntry...)
-		newChildren[entryName] = make([]Revision, len(childrenEntry))
-		copy(newChildren[entryName], childrenEntry)
-	}
-
-	childrenFields := ChildrenFields(forkRev.GetData())
-
-	for fieldName, field := range childrenFields {
-		forkList := forkRev.GetChildren(fieldName)
-		srcList := srcRev.GetChildren(fieldName)
-		dstList := dstRev.GetChildren(fieldName)
-
-		if revisionsAreEqual(dstList, srcList) {
-			for _, rev := range srcList {
-				mergeChildFunc(rev)
-			}
-			continue
-		}
-
-		if field.Key == "" {
-			if revisionsAreEqual(dstList, forkList) {
-				if !revisionsAreEqual(srcList, forkList) {
-					log.Error("we should not be here")
-				} else {
-					for _, rev := range srcList {
-						newChildren[fieldName] = append(newChildren[fieldName], mergeChildFunc(rev))
-					}
-					if field.IsContainer {
-						changes = append(
-							changes, ChangeTuple{POST_LISTCHANGE,
-								NewOperationContext("", nil, fieldName, ""), nil},
-						)
-					}
-				}
-			} else {
-				if !revisionsAreEqual(srcList, forkList) {
-					log.Error("cannot merge - single child node or un-keyed children list has changed")
-				}
-			}
-		} else {
-			if revisionsAreEqual(dstList, forkList) {
-				src := newChangeAnalysis(forkList, srcList, field.Key)
-
-				newList := make([]Revision, len(srcList))
-				copy(newList, srcList)
-
-				for key := range src.AddedKeys {
-					idx := src.KeyMap2[key]
-					newRev := mergeChildFunc(newList[idx])
-
-					// FIXME: newRev may come back as nil... exclude those entries for now
-					if newRev != nil {
-						newList[idx] = newRev
-						changes = append(changes, ChangeTuple{POST_ADD, newList[idx].GetData(), newRev.GetData()})
-					}
-				}
-				for key := range src.RemovedKeys {
-					oldRev := forkList[src.KeyMap1[key]]
-					revsToDiscard = append(revsToDiscard, oldRev)
-					changes = append(changes, ChangeTuple{POST_REMOVE, oldRev.GetData(), nil})
-				}
-				for key := range src.ChangedKeys {
-					idx := src.KeyMap2[key]
-					newRev := mergeChildFunc(newList[idx])
-
-					// FIXME: newRev may come back as nil... exclude those entries for now
-					if newRev != nil {
-						newList[idx] = newRev
-					}
-				}
-
-				if !dryRun {
-					newChildren[fieldName] = newList
-				}
-			} else {
-				src := newChangeAnalysis(forkList, srcList, field.Key)
-				dst := newChangeAnalysis(forkList, dstList, field.Key)
-
-				newList := make([]Revision, len(dstList))
-				copy(newList, dstList)
-
-				for key := range src.AddedKeys {
-					if _, exists := dst.AddedKeys[key]; exists {
-						childDstRev := dstList[dst.KeyMap2[key]]
-						childSrcRev := srcList[src.KeyMap2[key]]
-						if childDstRev.GetHash() == childSrcRev.GetHash() {
-							mergeChildFunc(childDstRev)
-						} else {
-							log.Error("conflict error - revision has been added is different")
-						}
-					} else {
-						newRev := mergeChildFunc(srcList[src.KeyMap2[key]])
-						newList = append(newList, newRev)
-						changes = append(changes, ChangeTuple{POST_ADD, srcList[src.KeyMap2[key]], newRev.GetData()})
-					}
-				}
-				for key := range src.ChangedKeys {
-					if _, removed := dst.RemovedKeys[key]; removed {
-						log.Error("conflict error - revision has been removed")
-					} else if _, changed := dst.ChangedKeys[key]; changed {
-						childDstRev := dstList[dst.KeyMap2[key]]
-						childSrcRev := srcList[src.KeyMap2[key]]
-						if childDstRev.GetHash() == childSrcRev.GetHash() {
-							mergeChildFunc(childSrcRev)
-						} else if childDstRev.GetConfig().Hash != childSrcRev.GetConfig().Hash {
-							log.Error("conflict error - revision has been changed and is different")
-						} else {
-							newRev := mergeChildFunc(srcList[src.KeyMap2[key]])
-							newList[dst.KeyMap2[key]] = newRev
-						}
-					} else {
-						newRev := mergeChildFunc(srcList[src.KeyMap2[key]])
-						newList[dst.KeyMap2[key]] = newRev
-					}
-				}
-
-				// TODO: how do i sort this map in reverse order?
-				for key := range src.RemovedKeys {
-					if _, changed := dst.ChangedKeys[key]; changed {
-						log.Error("conflict error - revision has changed")
-					}
-					if _, removed := dst.RemovedKeys[key]; !removed {
-						dstIdx := dst.KeyMap2[key]
-						oldRev := newList[dstIdx]
-						revsToDiscard = append(revsToDiscard, oldRev)
-
-						copy(newList[dstIdx:], newList[dstIdx+1:])
-						newList[len(newList)-1] = nil
-						newList = newList[:len(newList)-1]
-
-						changes = append(changes, ChangeTuple{POST_REMOVE, oldRev.GetData(), nil})
-					}
-				}
-
-				if !dryRun {
-					newChildren[fieldName] = newList
-				}
-			}
-		}
-	}
-
-	if !dryRun && len(newChildren) > 0 {
-		if configChanged {
-			rev = srcRev
-		} else {
-			rev = dstRev
-		}
-
-		for _, discarded := range revsToDiscard {
-			discarded.Drop("", true)
-		}
-
-		// FIXME: Do not discard the latest value for now
-		//dstRev.GetBranch().GetLatest().Drop("", configChanged)
-		rev = rev.UpdateAllChildren(newChildren, dstRev.GetBranch())
-
-		if configChanged {
-			changes = append(changes, ChangeTuple{POST_UPDATE, dstRev.GetBranch().GetLatest().GetData(), rev.GetData()})
-		}
-		return rev, changes
-	}
-
-	return nil, nil
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/model.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/model.go
deleted file mode 100644
index ba4a9b1..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/model.go
+++ /dev/null
@@ -1,37 +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 model
-
-import (
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-)
-
-func init() {
-	log.AddPackage(log.JSON, log.InfoLevel, log.Fields{"instanceId": "DB_MODEL"})
-	defer log.CleanUp()
-}
-
-const (
-	// period to determine when data requires a refresh (in milliseconds)
-	// TODO: make this configurable?
-	DataRefreshPeriod int64 = 5000
-
-	// Attribute used to store a timestamp in the context object
-	RequestTimestamp = "request-timestamp"
-
-	// Time limit for a KV path reservation (in seconds)
-	ReservationTTL int64 = 180
-)
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/node.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/node.go
deleted file mode 100644
index 264a9dd..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/node.go
+++ /dev/null
@@ -1,1161 +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 model
-
-// TODO: proper error handling
-// TODO: proper logging
-
-import (
-	"context"
-	"fmt"
-	"github.com/golang/protobuf/proto"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"reflect"
-	"strings"
-	"sync"
-	"time"
-)
-
-// When a branch has no transaction id, everything gets stored in NONE
-const (
-	NONE string = "none"
-)
-
-// Node interface is an abstraction of the node data structure
-type Node interface {
-	MakeLatest(branch *Branch, revision Revision, changeAnnouncement []ChangeTuple)
-
-	// CRUD functions
-	Add(ctx context.Context, path string, data interface{}, txid string, makeBranch MakeBranchFunction) Revision
-	Get(ctx context.Context, path string, hash string, depth int, deep bool, txid string) interface{}
-	List(ctx context.Context, path string, hash string, depth int, deep bool, txid string) interface{}
-	Update(ctx context.Context, path string, data interface{}, strict bool, txid string, makeBranch MakeBranchFunction) Revision
-	Remove(ctx context.Context, path string, txid string, makeBranch MakeBranchFunction) Revision
-	CreateProxy(ctx context.Context, path string, exclusive bool) *Proxy
-
-	GetProxy() *Proxy
-
-	MakeBranch(txid string) *Branch
-	DeleteBranch(txid string)
-	MergeBranch(txid string, dryRun bool) (Revision, error)
-
-	MakeTxBranch() string
-	DeleteTxBranch(txid string)
-	FoldTxBranch(txid string)
-}
-
-type node struct {
-	mutex     sync.RWMutex
-	Root      *root
-	Type      interface{}
-	Branches  map[string]*Branch
-	Tags      map[string]Revision
-	Proxy     *Proxy
-	EventBus  *EventBus
-	AutoPrune bool
-}
-
-// ChangeTuple holds details of modifications made to a revision
-type ChangeTuple struct {
-	Type         CallbackType
-	PreviousData interface{}
-	LatestData   interface{}
-}
-
-// NewNode creates a new instance of the node data structure
-func NewNode(root *root, initialData interface{}, autoPrune bool, txid string) *node {
-	n := &node{}
-
-	n.Root = root
-	n.Branches = make(map[string]*Branch)
-	n.Tags = make(map[string]Revision)
-	n.Proxy = nil
-	n.EventBus = nil
-	n.AutoPrune = autoPrune
-
-	if IsProtoMessage(initialData) {
-		n.Type = reflect.ValueOf(initialData).Interface()
-		dataCopy := proto.Clone(initialData.(proto.Message))
-		n.initialize(dataCopy, txid)
-	} else if reflect.ValueOf(initialData).IsValid() {
-		// FIXME: this block does not reflect the original implementation
-		// it should be checking if the provided initial_data is already a type!??!
-		// it should be checked before IsProtoMessage
-		n.Type = reflect.ValueOf(initialData).Interface()
-	} else {
-		// not implemented error
-		log.Errorf("cannot process initial data - %+v", initialData)
-	}
-
-	return n
-}
-
-// MakeNode creates a new node in the tree
-func (n *node) MakeNode(data interface{}, txid string) *node {
-	return NewNode(n.Root, data, true, txid)
-}
-
-// MakeRevision create a new revision of the node in the tree
-func (n *node) MakeRevision(branch *Branch, data interface{}, children map[string][]Revision) Revision {
-	return n.GetRoot().MakeRevision(branch, data, children)
-}
-
-// makeLatest will mark the revision of a node as being the latest
-func (n *node) makeLatest(branch *Branch, revision Revision, changeAnnouncement []ChangeTuple) {
-	// Keep a reference to the current revision
-	var previous string
-	if branch.GetLatest() != nil {
-		previous = branch.GetLatest().GetHash()
-	}
-
-	branch.AddRevision(revision)
-
-	// If anything is new, then set the revision as the latest
-	if branch.GetLatest() == nil || revision.GetHash() != branch.GetLatest().GetHash() {
-		if revision.GetName() != "" {
-			log.Debugw("saving-latest-data", log.Fields{"hash": revision.GetHash(), "data": revision.GetData()})
-			// Tag a timestamp to that revision
-			revision.SetLastUpdate()
-			GetRevCache().Set(revision.GetName(), revision)
-		}
-		branch.SetLatest(revision)
-	}
-
-	// Delete the previous revision if anything has changed
-	if previous != "" && previous != branch.GetLatest().GetHash() {
-		branch.DeleteRevision(previous)
-	}
-
-	if changeAnnouncement != nil && branch.Txid == "" {
-		if n.Proxy != nil {
-			for _, change := range changeAnnouncement {
-				log.Debugw("adding-callback",
-					log.Fields{
-						"callbacks":    n.GetProxy().getCallbacks(change.Type),
-						"type":         change.Type,
-						"previousData": change.PreviousData,
-						"latestData":   change.LatestData,
-					})
-				n.Root.AddCallback(
-					n.GetProxy().InvokeCallbacks,
-					change.Type,
-					true,
-					change.PreviousData,
-					change.LatestData)
-			}
-		}
-	}
-}
-
-// Latest returns the latest revision of node with or without the transaction id
-func (n *node) Latest(txid ...string) Revision {
-	var branch *Branch
-
-	if len(txid) > 0 && txid[0] != "" {
-		if branch = n.GetBranch(txid[0]); branch != nil {
-			return branch.GetLatest()
-		}
-	} else if branch = n.GetBranch(NONE); branch != nil {
-		return branch.GetLatest()
-	}
-	return nil
-}
-
-// initialize prepares the content of a node along with its possible ramifications
-func (n *node) initialize(data interface{}, txid string) {
-	children := make(map[string][]Revision)
-	for fieldName, field := range ChildrenFields(n.Type) {
-		_, fieldValue := GetAttributeValue(data, fieldName, 0)
-
-		if fieldValue.IsValid() {
-			if field.IsContainer {
-				if field.Key != "" {
-					for i := 0; i < fieldValue.Len(); i++ {
-						v := fieldValue.Index(i)
-
-						if rev := n.MakeNode(v.Interface(), txid).Latest(txid); rev != nil {
-							children[fieldName] = append(children[fieldName], rev)
-						}
-
-						// TODO: The following logic was ported from v1.0.  Need to verify if it is required
-						//var keysSeen []string
-						//_, key := GetAttributeValue(v.Interface(), field.Key, 0)
-						//for _, k := range keysSeen {
-						//	if k == key.String() {
-						//		//log.Errorf("duplicate key - %s", k)
-						//	}
-						//}
-						//keysSeen = append(keysSeen, key.String())
-					}
-
-				} else {
-					for i := 0; i < fieldValue.Len(); i++ {
-						v := fieldValue.Index(i)
-						if newNodeRev := n.MakeNode(v.Interface(), txid).Latest(); newNodeRev != nil {
-							children[fieldName] = append(children[fieldName], newNodeRev)
-						}
-					}
-				}
-			} else {
-				if newNodeRev := n.MakeNode(fieldValue.Interface(), txid).Latest(); newNodeRev != nil {
-					children[fieldName] = append(children[fieldName], newNodeRev)
-				}
-			}
-		} else {
-			log.Errorf("field is invalid - %+v", fieldValue)
-		}
-	}
-
-	branch := NewBranch(n, "", nil, n.AutoPrune)
-	rev := n.MakeRevision(branch, data, children)
-	n.makeLatest(branch, rev, nil)
-
-	if txid == "" {
-		n.SetBranch(NONE, branch)
-	} else {
-		n.SetBranch(txid, branch)
-	}
-}
-
-// findRevByKey retrieves a specific revision from a node tree
-func (n *node) findRevByKey(revs []Revision, keyName string, value interface{}) (int, Revision) {
-	for i, rev := range revs {
-		dataValue := reflect.ValueOf(rev.GetData())
-		dataStruct := GetAttributeStructure(rev.GetData(), keyName, 0)
-
-		fieldValue := dataValue.Elem().FieldByName(dataStruct.Name)
-
-		a := fmt.Sprintf("%s", fieldValue.Interface())
-		b := fmt.Sprintf("%s", value)
-		if a == b {
-			return i, revs[i]
-		}
-	}
-
-	return -1, nil
-}
-
-// Get retrieves the data from a node tree that resides at the specified path
-func (n *node) List(ctx context.Context, path string, hash string, depth int, deep bool, txid string) interface{} {
-	n.mutex.Lock()
-	defer n.mutex.Unlock()
-
-	log.Debugw("node-list-request", log.Fields{"path": path, "hash": hash, "depth": depth, "deep": deep, "txid": txid})
-	if deep {
-		depth = -1
-	}
-
-	for strings.HasPrefix(path, "/") {
-		path = path[1:]
-	}
-
-	var branch *Branch
-	var rev Revision
-
-	if branch = n.GetBranch(txid); txid == "" || branch == nil {
-		branch = n.GetBranch(NONE)
-	}
-
-	if hash != "" {
-		rev = branch.GetRevision(hash)
-	} else {
-		rev = branch.GetLatest()
-	}
-
-	var result interface{}
-	var prList []interface{}
-	if pr := rev.LoadFromPersistence(ctx, path, txid, nil); pr != nil {
-		for _, revEntry := range pr {
-			prList = append(prList, revEntry.GetData())
-		}
-		result = prList
-	}
-
-	return result
-}
-
-// Get retrieves the data from a node tree that resides at the specified path
-func (n *node) Get(ctx context.Context, path string, hash string, depth int, reconcile bool, txid string) interface{} {
-	n.mutex.Lock()
-	defer n.mutex.Unlock()
-
-	log.Debugw("node-get-request", log.Fields{"path": path, "hash": hash, "depth": depth, "reconcile": reconcile, "txid": txid})
-
-	for strings.HasPrefix(path, "/") {
-		path = path[1:]
-	}
-
-	var branch *Branch
-	var rev Revision
-
-	if branch = n.GetBranch(txid); txid == "" || branch == nil {
-		branch = n.GetBranch(NONE)
-	}
-
-	if hash != "" {
-		rev = branch.GetRevision(hash)
-	} else {
-		rev = branch.GetLatest()
-	}
-
-	var result interface{}
-
-	// If there is no request to reconcile, try to get it from memory
-	if !reconcile {
-		// Try to find an entry matching the path value from one of these sources
-		// 1.  Start with the cache which stores revisions by watch names
-		// 2.  Then look in the revision tree, especially if it's a sub-path such as /devices/1234/flows
-		// 3.  Move on to the KV store if that path cannot be found or if the entry has expired
-		if entry, exists := GetRevCache().Get(path); exists && entry.(Revision) != nil {
-			entryAge := time.Now().Sub(entry.(Revision).GetLastUpdate()).Nanoseconds() / int64(time.Millisecond)
-			if entryAge < DataRefreshPeriod {
-				log.Debugw("using-cache-entry", log.Fields{
-					"path": path,
-					"hash": hash,
-					"age":  entryAge,
-				})
-				return proto.Clone(entry.(Revision).GetData().(proto.Message))
-			} else {
-				log.Debugw("cache-entry-expired", log.Fields{"path": path, "hash": hash, "age": entryAge})
-			}
-		} else if result = n.getPath(ctx, rev.GetBranch().GetLatest(), path, depth); result != nil && reflect.ValueOf(result).IsValid() && !reflect.ValueOf(result).IsNil() {
-			log.Debugw("using-rev-tree-entry", log.Fields{"path": path, "hash": hash, "depth": depth, "reconcile": reconcile, "txid": txid})
-			return result
-		} else {
-			log.Debugw("not-using-cache-entry", log.Fields{
-				"path": path,
-				"hash": hash, "depth": depth,
-				"reconcile": reconcile,
-				"txid":      txid,
-			})
-		}
-	} else {
-		log.Debugw("reconcile-requested", log.Fields{
-			"path":      path,
-			"hash":      hash,
-			"reconcile": reconcile,
-		})
-	}
-
-	// If we got to this point, we are either trying to reconcile with the db
-	// or we simply failed at getting information from memory
-	if n.Root.KvStore != nil {
-		if pr := rev.LoadFromPersistence(ctx, path, txid, nil); pr != nil && len(pr) > 0 {
-			// Did we receive a single or multiple revisions?
-			if len(pr) > 1 {
-				var revs []interface{}
-				for _, revEntry := range pr {
-					revs = append(revs, revEntry.GetData())
-				}
-				result = revs
-			} else {
-				result = pr[0].GetData()
-			}
-		}
-	}
-
-	return result
-}
-
-//getPath traverses the specified path and retrieves the data associated to it
-func (n *node) getPath(ctx context.Context, rev Revision, path string, depth int) interface{} {
-	if path == "" {
-		return n.getData(rev, depth)
-	}
-
-	partition := strings.SplitN(path, "/", 2)
-	name := partition[0]
-
-	if len(partition) < 2 {
-		path = ""
-	} else {
-		path = partition[1]
-	}
-
-	names := ChildrenFields(n.Type)
-	field := names[name]
-
-	if field != nil && field.IsContainer {
-		children := make([]Revision, len(rev.GetChildren(name)))
-		copy(children, rev.GetChildren(name))
-
-		if field.Key != "" {
-			if path != "" {
-				partition = strings.SplitN(path, "/", 2)
-				key := partition[0]
-				path = ""
-				keyValue := field.KeyFromStr(key)
-				if _, childRev := n.findRevByKey(children, field.Key, keyValue); childRev == nil {
-					return nil
-				} else {
-					childNode := childRev.GetNode()
-					return childNode.getPath(ctx, childRev, path, depth)
-				}
-			} else {
-				var response []interface{}
-				for _, childRev := range children {
-					childNode := childRev.GetNode()
-					value := childNode.getData(childRev, depth)
-					response = append(response, value)
-				}
-				return response
-			}
-		} else {
-			var response []interface{}
-			if path != "" {
-				// TODO: raise error
-				return response
-			}
-			for _, childRev := range children {
-				childNode := childRev.GetNode()
-				value := childNode.getData(childRev, depth)
-				response = append(response, value)
-			}
-			return response
-		}
-	} else if children := rev.GetChildren(name); children != nil && len(children) > 0 {
-		childRev := children[0]
-		childNode := childRev.GetNode()
-		return childNode.getPath(ctx, childRev, path, depth)
-	}
-
-	return nil
-}
-
-// getData retrieves the data from a node revision
-func (n *node) getData(rev Revision, depth int) interface{} {
-	msg := rev.GetBranch().GetLatest().Get(depth)
-	var modifiedMsg interface{}
-
-	if n.GetProxy() != nil {
-		log.Debugw("invoking-get-callbacks", log.Fields{"data": msg})
-		if modifiedMsg = n.GetProxy().InvokeCallbacks(GET, false, msg); modifiedMsg != nil {
-			msg = modifiedMsg
-		}
-
-	}
-
-	return msg
-}
-
-// Update changes the content of a node at the specified path with the provided data
-func (n *node) Update(ctx context.Context, path string, data interface{}, strict bool, txid string, makeBranch MakeBranchFunction) Revision {
-	n.mutex.Lock()
-	defer n.mutex.Unlock()
-
-	log.Debugw("node-update-request", log.Fields{"path": path, "strict": strict, "txid": txid})
-
-	for strings.HasPrefix(path, "/") {
-		path = path[1:]
-	}
-
-	var branch *Branch
-	if txid == "" {
-		branch = n.GetBranch(NONE)
-	} else if branch = n.GetBranch(txid); branch == nil {
-		branch = makeBranch(n)
-	}
-
-	if branch.GetLatest() != nil {
-		log.Debugf("Branch data : %+v, Passed data: %+v", branch.GetLatest().GetData(), data)
-	}
-	if path == "" {
-		return n.doUpdate(ctx, branch, data, strict)
-	}
-
-	rev := branch.GetLatest()
-
-	partition := strings.SplitN(path, "/", 2)
-	name := partition[0]
-
-	if len(partition) < 2 {
-		path = ""
-	} else {
-		path = partition[1]
-	}
-
-	field := ChildrenFields(n.Type)[name]
-	var children []Revision
-
-	if field == nil {
-		return n.doUpdate(ctx, branch, data, strict)
-	}
-
-	if field.IsContainer {
-		if path == "" {
-			log.Errorf("cannot update a list")
-		} else if field.Key != "" {
-			partition := strings.SplitN(path, "/", 2)
-			key := partition[0]
-			if len(partition) < 2 {
-				path = ""
-			} else {
-				path = partition[1]
-			}
-			keyValue := field.KeyFromStr(key)
-
-			children = make([]Revision, len(rev.GetChildren(name)))
-			copy(children, rev.GetChildren(name))
-
-			idx, childRev := n.findRevByKey(children, field.Key, keyValue)
-
-			if childRev == nil {
-				log.Debugw("child-revision-is-nil", log.Fields{"key": keyValue})
-				return branch.GetLatest()
-			}
-
-			childNode := childRev.GetNode()
-
-			// Save proxy in child node to ensure callbacks are called later on
-			// only assign in cases of non sub-folder proxies, i.e. "/"
-			if childNode.Proxy == nil && n.Proxy != nil && n.GetProxy().getFullPath() == "" {
-				childNode.Proxy = n.Proxy
-			}
-
-			newChildRev := childNode.Update(ctx, path, data, strict, txid, makeBranch)
-
-			if newChildRev.GetHash() == childRev.GetHash() {
-				if newChildRev != childRev {
-					log.Debug("clear-hash - %s %+v", newChildRev.GetHash(), newChildRev)
-					newChildRev.ClearHash()
-				}
-				log.Debugw("child-revisions-have-matching-hash", log.Fields{"hash": childRev.GetHash(), "key": keyValue})
-				return branch.GetLatest()
-			}
-
-			_, newKey := GetAttributeValue(newChildRev.GetData(), field.Key, 0)
-
-			_newKeyType := fmt.Sprintf("%s", newKey)
-			_keyValueType := fmt.Sprintf("%s", keyValue)
-
-			if _newKeyType != _keyValueType {
-				log.Errorf("cannot change key field")
-			}
-
-			// Prefix the hash value with the data type (e.g. devices, logical_devices, adapters)
-			newChildRev.SetName(name + "/" + _keyValueType)
-
-			branch.LatestLock.Lock()
-			defer branch.LatestLock.Unlock()
-
-			if idx >= 0 {
-				children[idx] = newChildRev
-			} else {
-				children = append(children, newChildRev)
-			}
-
-			updatedRev := rev.UpdateChildren(ctx, name, children, branch)
-
-			n.makeLatest(branch, updatedRev, nil)
-			updatedRev.ChildDrop(name, childRev.GetHash())
-
-			return newChildRev
-
-		} else {
-			log.Errorf("cannot index into container with no keys")
-		}
-	} else {
-		childRev := rev.GetChildren(name)[0]
-		childNode := childRev.GetNode()
-		newChildRev := childNode.Update(ctx, path, data, strict, txid, makeBranch)
-
-		branch.LatestLock.Lock()
-		defer branch.LatestLock.Unlock()
-
-		updatedRev := rev.UpdateChildren(ctx, name, []Revision{newChildRev}, branch)
-		n.makeLatest(branch, updatedRev, nil)
-
-		updatedRev.ChildDrop(name, childRev.GetHash())
-
-		return newChildRev
-	}
-
-	return nil
-}
-
-func (n *node) doUpdate(ctx context.Context, branch *Branch, data interface{}, strict bool) Revision {
-	log.Debugw("comparing-types", log.Fields{"expected": reflect.ValueOf(n.Type).Type(), "actual": reflect.TypeOf(data)})
-
-	if reflect.TypeOf(data) != reflect.ValueOf(n.Type).Type() {
-		// TODO raise error
-		log.Errorw("types-do-not-match: %+v", log.Fields{"actual": reflect.TypeOf(data), "expected": n.Type})
-		return nil
-	}
-
-	// TODO: validate that this actually works
-	//if n.hasChildren(data) {
-	//	return nil
-	//}
-
-	if n.GetProxy() != nil {
-		log.Debug("invoking proxy PRE_UPDATE Callbacks")
-		n.GetProxy().InvokeCallbacks(PRE_UPDATE, false, branch.GetLatest(), data)
-	}
-
-	if branch.GetLatest().GetData().(proto.Message).String() != data.(proto.Message).String() {
-		if strict {
-			// TODO: checkAccessViolations(data, Branch.GetLatest.data)
-			log.Debugf("checking access violations")
-		}
-
-		rev := branch.GetLatest().UpdateData(ctx, data, branch)
-		changes := []ChangeTuple{{POST_UPDATE, branch.GetLatest().GetData(), rev.GetData()}}
-		n.makeLatest(branch, rev, changes)
-
-		return rev
-	}
-	return branch.GetLatest()
-}
-
-// Add inserts a new node at the specified path with the provided data
-func (n *node) Add(ctx context.Context, path string, data interface{}, txid string, makeBranch MakeBranchFunction) Revision {
-	n.mutex.Lock()
-	defer n.mutex.Unlock()
-
-	log.Debugw("node-add-request", log.Fields{"path": path, "txid": txid})
-
-	for strings.HasPrefix(path, "/") {
-		path = path[1:]
-	}
-	if path == "" {
-		// TODO raise error
-		log.Errorf("cannot add for non-container mode")
-		return nil
-	}
-
-	var branch *Branch
-	if txid == "" {
-		branch = n.GetBranch(NONE)
-	} else if branch = n.GetBranch(txid); branch == nil {
-		branch = makeBranch(n)
-	}
-
-	rev := branch.GetLatest()
-
-	partition := strings.SplitN(path, "/", 2)
-	name := partition[0]
-
-	if len(partition) < 2 {
-		path = ""
-	} else {
-		path = partition[1]
-	}
-
-	field := ChildrenFields(n.Type)[name]
-
-	var children []Revision
-
-	if field.IsContainer {
-		if path == "" {
-			if field.Key != "" {
-				if n.GetProxy() != nil {
-					log.Debug("invoking proxy PRE_ADD Callbacks")
-					n.GetProxy().InvokeCallbacks(PRE_ADD, false, data)
-				}
-
-				children = make([]Revision, len(rev.GetChildren(name)))
-				copy(children, rev.GetChildren(name))
-
-				_, key := GetAttributeValue(data, field.Key, 0)
-
-				if _, exists := n.findRevByKey(children, field.Key, key.String()); exists != nil {
-					// TODO raise error
-					log.Warnw("duplicate-key-found", log.Fields{"key": key.String()})
-					return exists
-				}
-				childRev := n.MakeNode(data, "").Latest()
-
-				// Prefix the hash with the data type (e.g. devices, logical_devices, adapters)
-				childRev.SetName(name + "/" + key.String())
-
-				branch.LatestLock.Lock()
-				defer branch.LatestLock.Unlock()
-
-				children = append(children, childRev)
-
-				updatedRev := rev.UpdateChildren(ctx, name, children, branch)
-				changes := []ChangeTuple{{POST_ADD, nil, childRev.GetData()}}
-				childRev.SetupWatch(childRev.GetName())
-
-				n.makeLatest(branch, updatedRev, changes)
-
-				return childRev
-			}
-			log.Errorf("cannot add to non-keyed container")
-
-		} else if field.Key != "" {
-			partition := strings.SplitN(path, "/", 2)
-			key := partition[0]
-			if len(partition) < 2 {
-				path = ""
-			} else {
-				path = partition[1]
-			}
-			keyValue := field.KeyFromStr(key)
-
-			children = make([]Revision, len(rev.GetChildren(name)))
-			copy(children, rev.GetChildren(name))
-
-			idx, childRev := n.findRevByKey(children, field.Key, keyValue)
-
-			if childRev == nil {
-				return branch.GetLatest()
-			}
-
-			childNode := childRev.GetNode()
-			newChildRev := childNode.Add(ctx, path, data, txid, makeBranch)
-
-			// Prefix the hash with the data type (e.g. devices, logical_devices, adapters)
-			newChildRev.SetName(name + "/" + keyValue.(string))
-
-			branch.LatestLock.Lock()
-			defer branch.LatestLock.Unlock()
-
-			if idx >= 0 {
-				children[idx] = newChildRev
-			} else {
-				children = append(children, newChildRev)
-			}
-
-			updatedRev := rev.UpdateChildren(ctx, name, children, branch)
-			n.makeLatest(branch, updatedRev, nil)
-
-			updatedRev.ChildDrop(name, childRev.GetHash())
-
-			return newChildRev
-		} else {
-			log.Errorf("cannot add to non-keyed container")
-		}
-	} else {
-		log.Errorf("cannot add to non-container field")
-	}
-
-	return nil
-}
-
-// Remove eliminates a node at the specified path
-func (n *node) Remove(ctx context.Context, path string, txid string, makeBranch MakeBranchFunction) Revision {
-	n.mutex.Lock()
-	defer n.mutex.Unlock()
-
-	log.Debugw("node-remove-request", log.Fields{"path": path, "txid": txid, "makeBranch": makeBranch})
-
-	for strings.HasPrefix(path, "/") {
-		path = path[1:]
-	}
-	if path == "" {
-		// TODO raise error
-		log.Errorf("cannot remove for non-container mode")
-	}
-	var branch *Branch
-	if txid == "" {
-		branch = n.GetBranch(NONE)
-	} else if branch = n.GetBranch(txid); branch == nil {
-		branch = makeBranch(n)
-	}
-
-	rev := branch.GetLatest()
-
-	partition := strings.SplitN(path, "/", 2)
-	name := partition[0]
-	if len(partition) < 2 {
-		path = ""
-	} else {
-		path = partition[1]
-	}
-
-	field := ChildrenFields(n.Type)[name]
-	var children []Revision
-	postAnnouncement := []ChangeTuple{}
-
-	if field.IsContainer {
-		if path == "" {
-			log.Errorw("cannot-remove-without-key", log.Fields{"name": name, "key": path})
-		} else if field.Key != "" {
-			partition := strings.SplitN(path, "/", 2)
-			key := partition[0]
-			if len(partition) < 2 {
-				path = ""
-			} else {
-				path = partition[1]
-			}
-
-			keyValue := field.KeyFromStr(key)
-			children = make([]Revision, len(rev.GetChildren(name)))
-			copy(children, rev.GetChildren(name))
-
-			if path != "" {
-				if idx, childRev := n.findRevByKey(children, field.Key, keyValue); childRev != nil {
-					childNode := childRev.GetNode()
-					if childNode.Proxy == nil {
-						childNode.Proxy = n.Proxy
-					}
-					newChildRev := childNode.Remove(ctx, path, txid, makeBranch)
-
-					branch.LatestLock.Lock()
-					defer branch.LatestLock.Unlock()
-
-					if idx >= 0 {
-						children[idx] = newChildRev
-					} else {
-						children = append(children, newChildRev)
-					}
-
-					rev.SetChildren(name, children)
-					branch.GetLatest().Drop(txid, false)
-					n.makeLatest(branch, rev, nil)
-				}
-				return branch.GetLatest()
-			}
-
-			if idx, childRev := n.findRevByKey(children, field.Key, keyValue); childRev != nil && idx >= 0 {
-				if n.GetProxy() != nil {
-					data := childRev.GetData()
-					n.GetProxy().InvokeCallbacks(PRE_REMOVE, false, data)
-					postAnnouncement = append(postAnnouncement, ChangeTuple{POST_REMOVE, data, nil})
-				} else {
-					postAnnouncement = append(postAnnouncement, ChangeTuple{POST_REMOVE, childRev.GetData(), nil})
-				}
-
-				childRev.StorageDrop(txid, true)
-				GetRevCache().Delete(childRev.GetName())
-
-				branch.LatestLock.Lock()
-				defer branch.LatestLock.Unlock()
-
-				children = append(children[:idx], children[idx+1:]...)
-				rev.SetChildren(name, children)
-
-				branch.GetLatest().Drop(txid, false)
-				n.makeLatest(branch, rev, postAnnouncement)
-
-				return rev
-			} else {
-				log.Errorw("failed-to-find-revision", log.Fields{"name": name, "key": keyValue.(string)})
-			}
-		}
-		log.Errorw("cannot-add-to-non-keyed-container", log.Fields{"name": name, "path": path, "fieldKey": field.Key})
-
-	} else {
-		log.Errorw("cannot-add-to-non-container-field", log.Fields{"name": name, "path": path})
-	}
-
-	return nil
-}
-
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Branching ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-// MakeBranchFunction is a type for function references intented to create a branch
-type MakeBranchFunction func(*node) *Branch
-
-// MakeBranch creates a new branch for the provided transaction id
-func (n *node) MakeBranch(txid string) *Branch {
-	branchPoint := n.GetBranch(NONE).GetLatest()
-	branch := NewBranch(n, txid, branchPoint, true)
-	n.SetBranch(txid, branch)
-	return branch
-}
-
-// DeleteBranch removes a branch with the specified id
-func (n *node) DeleteBranch(txid string) {
-	delete(n.Branches, txid)
-}
-
-func (n *node) mergeChild(txid string, dryRun bool) func(Revision) Revision {
-	f := func(rev Revision) Revision {
-		childBranch := rev.GetBranch()
-
-		if childBranch.Txid == txid {
-			rev, _ = childBranch.Node.MergeBranch(txid, dryRun)
-		}
-
-		return rev
-	}
-	return f
-}
-
-// MergeBranch will integrate the contents of a transaction branch within the latest branch of a given node
-func (n *node) MergeBranch(txid string, dryRun bool) (Revision, error) {
-	srcBranch := n.GetBranch(txid)
-	dstBranch := n.GetBranch(NONE)
-
-	forkRev := srcBranch.Origin
-	srcRev := srcBranch.GetLatest()
-	dstRev := dstBranch.GetLatest()
-
-	rev, changes := Merge3Way(forkRev, srcRev, dstRev, n.mergeChild(txid, dryRun), dryRun)
-
-	if !dryRun {
-		if rev != nil {
-			rev.SetName(dstRev.GetName())
-			n.makeLatest(dstBranch, rev, changes)
-		}
-		n.DeleteBranch(txid)
-	}
-
-	// TODO: return proper error when one occurs
-	return rev, nil
-}
-
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Diff utility ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-//func (n *node) diff(hash1, hash2, txid string) {
-//	branch := n.Branches[txid]
-//	rev1 := branch.GetHash(hash1)
-//	rev2 := branch.GetHash(hash2)
-//
-//	if rev1.GetHash() == rev2.GetHash() {
-//		// empty patch
-//	} else {
-//		// translate data to json and generate patch
-//		patch, err := jsonpatch.MakePatch(rev1.GetData(), rev2.GetData())
-//		patch.
-//	}
-//}
-
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tag utility ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-// TODO: is tag mgmt used in the python implementation? Need to validate
-
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Internals ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-func (n *node) hasChildren(data interface{}) bool {
-	for fieldName, field := range ChildrenFields(n.Type) {
-		_, fieldValue := GetAttributeValue(data, fieldName, 0)
-
-		if (field.IsContainer && fieldValue.Len() > 0) || !fieldValue.IsNil() {
-			log.Error("cannot update external children")
-			return true
-		}
-	}
-
-	return false
-}
-
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ node Proxy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-// CreateProxy returns a reference to a sub-tree of the data model
-func (n *node) CreateProxy(ctx context.Context, path string, exclusive bool) *Proxy {
-	return n.createProxy(ctx, path, path, n, exclusive)
-}
-
-func (n *node) createProxy(ctx context.Context, path string, fullPath string, parentNode *node, exclusive bool) *Proxy {
-	log.Debugw("node-create-proxy", log.Fields{
-		"node-type":        reflect.ValueOf(n.Type).Type(),
-		"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-		"path":             path,
-		"fullPath":         fullPath,
-	})
-
-	for strings.HasPrefix(path, "/") {
-		path = path[1:]
-	}
-	if path == "" {
-		return n.makeProxy(path, fullPath, parentNode, exclusive)
-	}
-
-	rev := n.GetBranch(NONE).GetLatest()
-	partition := strings.SplitN(path, "/", 2)
-	name := partition[0]
-	var nodeType interface{}
-	if len(partition) < 2 {
-		path = ""
-		nodeType = n.Type
-	} else {
-		path = partition[1]
-		nodeType = parentNode.Type
-	}
-
-	field := ChildrenFields(nodeType)[name]
-
-	if field != nil {
-		if field.IsContainer {
-			log.Debugw("container-field", log.Fields{
-				"node-type":        reflect.ValueOf(n.Type).Type(),
-				"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-				"path":             path,
-				"name":             name,
-			})
-			if path == "" {
-				log.Debugw("folder-proxy", log.Fields{
-					"node-type":        reflect.ValueOf(n.Type).Type(),
-					"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-					"fullPath":         fullPath,
-					"name":             name,
-				})
-				newNode := n.MakeNode(reflect.New(field.ClassType.Elem()).Interface(), "")
-				return newNode.makeProxy(path, fullPath, parentNode, exclusive)
-			} else if field.Key != "" {
-				log.Debugw("key-proxy", log.Fields{
-					"node-type":        reflect.ValueOf(n.Type).Type(),
-					"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-					"fullPath":         fullPath,
-					"name":             name,
-				})
-				partition := strings.SplitN(path, "/", 2)
-				key := partition[0]
-				if len(partition) < 2 {
-					path = ""
-				} else {
-					path = partition[1]
-				}
-				keyValue := field.KeyFromStr(key)
-				var children []Revision
-				children = make([]Revision, len(rev.GetChildren(name)))
-				copy(children, rev.GetChildren(name))
-
-				var childRev Revision
-				if _, childRev = n.findRevByKey(children, field.Key, keyValue); childRev != nil {
-					log.Debugw("found-revision-matching-key-in-memory", log.Fields{
-						"node-type":        reflect.ValueOf(n.Type).Type(),
-						"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-						"fullPath":         fullPath,
-						"name":             name,
-					})
-				} else if revs := n.GetBranch(NONE).GetLatest().LoadFromPersistence(ctx, fullPath, "", nil); revs != nil && len(revs) > 0 {
-					log.Debugw("found-revision-matching-key-in-db", log.Fields{
-						"node-type":        reflect.ValueOf(n.Type).Type(),
-						"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-						"fullPath":         fullPath,
-						"name":             name,
-					})
-					childRev = revs[0]
-				} else {
-					log.Debugw("no-revision-matching-key", log.Fields{
-						"node-type":        reflect.ValueOf(n.Type).Type(),
-						"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-						"fullPath":         fullPath,
-						"name":             name,
-					})
-				}
-				if childRev != nil {
-					childNode := childRev.GetNode()
-					return childNode.createProxy(ctx, path, fullPath, n, exclusive)
-				}
-			} else {
-				log.Errorw("cannot-access-index-of-empty-container", log.Fields{
-					"node-type":        reflect.ValueOf(n.Type).Type(),
-					"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-					"path":             path,
-					"name":             name,
-				})
-			}
-		} else {
-			log.Debugw("non-container-field", log.Fields{
-				"node-type":        reflect.ValueOf(n.Type).Type(),
-				"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-				"path":             path,
-				"name":             name,
-			})
-			childRev := rev.GetChildren(name)[0]
-			childNode := childRev.GetNode()
-			return childNode.createProxy(ctx, path, fullPath, n, exclusive)
-		}
-	} else {
-		log.Debugw("field-object-is-nil", log.Fields{
-			"node-type":        reflect.ValueOf(n.Type).Type(),
-			"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-			"fullPath":         fullPath,
-			"name":             name,
-		})
-	}
-
-	log.Warnw("cannot-create-proxy", log.Fields{
-		"node-type":        reflect.ValueOf(n.Type).Type(),
-		"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-		"path":             path,
-		"fullPath":         fullPath,
-		"latest-rev":       rev.GetHash(),
-	})
-	return nil
-}
-
-func (n *node) makeProxy(path string, fullPath string, parentNode *node, exclusive bool) *Proxy {
-	log.Debugw("node-make-proxy", log.Fields{
-		"node-type":        reflect.ValueOf(n.Type).Type(),
-		"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-		"path":             path,
-		"fullPath":         fullPath,
-	})
-
-	r := &root{
-		node:                  n,
-		Callbacks:             n.Root.GetCallbacks(),
-		NotificationCallbacks: n.Root.GetNotificationCallbacks(),
-		DirtyNodes:            n.Root.DirtyNodes,
-		KvStore:               n.Root.KvStore,
-		Loading:               n.Root.Loading,
-		RevisionClass:         n.Root.RevisionClass,
-	}
-
-	if n.Proxy == nil {
-		log.Debugw("constructing-new-proxy", log.Fields{
-			"node-type":        reflect.ValueOf(n.Type).Type(),
-			"parent-node-type": reflect.ValueOf(parentNode.Type).Type(),
-			"path":             path,
-			"fullPath":         fullPath,
-		})
-		n.Proxy = NewProxy(r, n, parentNode, path, fullPath, exclusive)
-	} else {
-		log.Debugw("node-has-existing-proxy", log.Fields{
-			"node-type":        reflect.ValueOf(n.GetProxy().Node.Type).Type(),
-			"parent-node-type": reflect.ValueOf(n.GetProxy().ParentNode.Type).Type(),
-			"path":             n.GetProxy().Path,
-			"fullPath":         n.GetProxy().FullPath,
-		})
-		if n.GetProxy().Exclusive {
-			log.Error("node is already owned exclusively")
-		}
-	}
-
-	return n.Proxy
-}
-
-func (n *node) makeEventBus() *EventBus {
-	if n.EventBus == nil {
-		n.EventBus = NewEventBus()
-	}
-	return n.EventBus
-}
-
-func (n *node) SetProxy(proxy *Proxy) {
-	n.Proxy = proxy
-}
-
-func (n *node) GetProxy() *Proxy {
-	return n.Proxy
-}
-
-func (n *node) GetBranch(key string) *Branch {
-	if n.Branches != nil {
-		if branch, exists := n.Branches[key]; exists {
-			return branch
-		}
-	}
-	return nil
-}
-
-func (n *node) SetBranch(key string, branch *Branch) {
-	n.Branches[key] = branch
-}
-
-func (n *node) GetRoot() *root {
-	return n.Root
-}
-func (n *node) SetRoot(root *root) {
-	n.Root = root
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/non_persisted_revision.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/non_persisted_revision.go
deleted file mode 100644
index 384caed..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/non_persisted_revision.go
+++ /dev/null
@@ -1,514 +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 model
-
-import (
-	"bytes"
-	"context"
-	"crypto/md5"
-	"fmt"
-	"github.com/golang/protobuf/proto"
-	"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"reflect"
-	"sort"
-	"strings"
-	"sync"
-	"time"
-)
-
-// TODO: Cache logic will have to be revisited to cleanup unused entries in memory (disabled for now)
-//
-type revCacheSingleton struct {
-	sync.RWMutex
-	Cache sync.Map
-}
-
-func (s *revCacheSingleton) Get(path string) (interface{}, bool) {
-	return s.Cache.Load(path)
-}
-func (s *revCacheSingleton) Set(path string, value interface{}) {
-	s.Cache.Store(path, value)
-}
-func (s *revCacheSingleton) Delete(path string) {
-	s.Cache.Delete(path)
-}
-
-var revCacheInstance *revCacheSingleton
-var revCacheOnce sync.Once
-
-func GetRevCache() *revCacheSingleton {
-	revCacheOnce.Do(func() {
-		revCacheInstance = &revCacheSingleton{Cache: sync.Map{}}
-	})
-	return revCacheInstance
-}
-
-type NonPersistedRevision struct {
-	mutex        sync.RWMutex
-	Root         *root
-	Config       *DataRevision
-	childrenLock sync.RWMutex
-	Children     map[string][]Revision
-	Hash         string
-	Branch       *Branch
-	WeakRef      string
-	Name         string
-	lastUpdate   time.Time
-}
-
-func NewNonPersistedRevision(root *root, branch *Branch, data interface{}, children map[string][]Revision) Revision {
-	r := &NonPersistedRevision{}
-	r.Root = root
-	r.Branch = branch
-	r.Config = NewDataRevision(root, data)
-	r.Children = children
-	r.Hash = r.hashContent()
-	return r
-}
-
-func (npr *NonPersistedRevision) SetConfig(config *DataRevision) {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-	npr.Config = config
-}
-
-func (npr *NonPersistedRevision) GetConfig() *DataRevision {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-	return npr.Config
-}
-
-func (npr *NonPersistedRevision) SetAllChildren(children map[string][]Revision) {
-	npr.childrenLock.Lock()
-	defer npr.childrenLock.Unlock()
-	npr.Children = make(map[string][]Revision)
-
-	for key, value := range children {
-		npr.Children[key] = make([]Revision, len(value))
-		copy(npr.Children[key], value)
-	}
-}
-
-func (npr *NonPersistedRevision) SetChildren(name string, children []Revision) {
-	npr.childrenLock.Lock()
-	defer npr.childrenLock.Unlock()
-
-	npr.Children[name] = make([]Revision, len(children))
-	copy(npr.Children[name], children)
-}
-
-func (npr *NonPersistedRevision) GetAllChildren() map[string][]Revision {
-	npr.childrenLock.Lock()
-	defer npr.childrenLock.Unlock()
-
-	return npr.Children
-}
-
-func (npr *NonPersistedRevision) GetChildren(name string) []Revision {
-	npr.childrenLock.Lock()
-	defer npr.childrenLock.Unlock()
-
-	if _, exists := npr.Children[name]; exists {
-		return npr.Children[name]
-	}
-	return nil
-}
-
-func (npr *NonPersistedRevision) SetHash(hash string) {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-	npr.Hash = hash
-}
-
-func (npr *NonPersistedRevision) GetHash() string {
-	//npr.mutex.Lock()
-	//defer npr.mutex.Unlock()
-	return npr.Hash
-}
-
-func (npr *NonPersistedRevision) ClearHash() {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-	npr.Hash = ""
-}
-
-func (npr *NonPersistedRevision) GetName() string {
-	//npr.mutex.Lock()
-	//defer npr.mutex.Unlock()
-	return npr.Name
-}
-
-func (npr *NonPersistedRevision) SetName(name string) {
-	//npr.mutex.Lock()
-	//defer npr.mutex.Unlock()
-	npr.Name = name
-}
-func (npr *NonPersistedRevision) SetBranch(branch *Branch) {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-	npr.Branch = branch
-}
-
-func (npr *NonPersistedRevision) GetBranch() *Branch {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-	return npr.Branch
-}
-
-func (npr *NonPersistedRevision) GetData() interface{} {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-	if npr.Config == nil {
-		return nil
-	}
-	return npr.Config.Data
-}
-
-func (npr *NonPersistedRevision) GetNode() *node {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-	return npr.Branch.Node
-}
-
-func (npr *NonPersistedRevision) Finalize(skipOnExist bool) {
-	npr.Hash = npr.hashContent()
-}
-
-// hashContent generates a hash string based on the contents of the revision.
-// The string should be unique to avoid conflicts with other revisions
-func (npr *NonPersistedRevision) hashContent() string {
-	var buffer bytes.Buffer
-	var childrenKeys []string
-
-	if npr.Config != nil {
-		buffer.WriteString(npr.Config.Hash)
-	}
-
-	if npr.Name != "" {
-		buffer.WriteString(npr.Name)
-	}
-
-	for key := range npr.Children {
-		childrenKeys = append(childrenKeys, key)
-	}
-
-	sort.Strings(childrenKeys)
-
-	if len(npr.Children) > 0 {
-		// Loop through sorted Children keys
-		for _, key := range childrenKeys {
-			for _, child := range npr.Children[key] {
-				if child != nil && child.GetHash() != "" {
-					buffer.WriteString(child.GetHash())
-				}
-			}
-		}
-	}
-
-	return fmt.Sprintf("%x", md5.Sum(buffer.Bytes()))[:12]
-}
-
-// Get will retrieve the data for the current revision
-func (npr *NonPersistedRevision) Get(depth int) interface{} {
-	// 1. Clone the data to avoid any concurrent access issues
-	// 2. The current rev might still be pointing to an old config
-	//    thus, force the revision to get its latest value
-	latestRev := npr.GetBranch().GetLatest()
-	originalData := proto.Clone(latestRev.GetData().(proto.Message))
-	data := originalData
-
-	if depth != 0 {
-		// FIXME: Traversing the struct through reflection sometimes corrupts the data.
-		// Unlike the original python implementation, golang structs are not lazy loaded.
-		// Keeping this non-critical logic for now, but Get operations should be forced to
-		// depth=0 to avoid going through the following loop.
-		for fieldName, field := range ChildrenFields(latestRev.GetData()) {
-			childDataName, childDataHolder := GetAttributeValue(data, fieldName, 0)
-			if field.IsContainer {
-				for _, rev := range latestRev.GetChildren(fieldName) {
-					childData := rev.Get(depth - 1)
-					foundEntry := false
-					for i := 0; i < childDataHolder.Len(); i++ {
-						cdh_if := childDataHolder.Index(i).Interface()
-						if cdh_if.(proto.Message).String() == childData.(proto.Message).String() {
-							foundEntry = true
-							break
-						}
-					}
-					if !foundEntry {
-						// avoid duplicates by adding it only if the child was not found in the holder
-						childDataHolder = reflect.Append(childDataHolder, reflect.ValueOf(childData))
-					}
-				}
-			} else {
-				if revs := npr.GetBranch().GetLatest().GetChildren(fieldName); revs != nil && len(revs) > 0 {
-					rev := revs[0]
-					if rev != nil {
-						childData := rev.Get(depth - 1)
-						if reflect.TypeOf(childData) == reflect.TypeOf(childDataHolder.Interface()) {
-							childDataHolder = reflect.ValueOf(childData)
-						}
-					}
-				}
-			}
-			// Merge child data with cloned object
-			reflect.ValueOf(data).Elem().FieldByName(childDataName).Set(childDataHolder)
-		}
-	}
-
-	result := data
-
-	if result != nil {
-		// We need to send back a copy of the retrieved object
-		result = proto.Clone(data.(proto.Message))
-	}
-
-	return result
-}
-
-// UpdateData will refresh the data content of the revision
-func (npr *NonPersistedRevision) UpdateData(ctx context.Context, data interface{}, branch *Branch) Revision {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-
-	log.Debugw("update-data", log.Fields{"hash": npr.GetHash(), "current": npr.Config.Data, "provided": data})
-
-	// Do not update the revision if data is the same
-	if npr.Config.Data != nil && npr.Config.hashData(npr.Root, data) == npr.Config.Hash {
-		log.Debugw("stored-data-matches-latest", log.Fields{"stored": npr.Config.Data, "provided": data})
-		return npr
-	}
-
-	// Construct a new revision based on the current one
-	newRev := NonPersistedRevision{}
-	newRev.Config = NewDataRevision(npr.Root, data)
-	newRev.Hash = npr.Hash
-	newRev.Root = npr.Root
-	newRev.Name = npr.Name
-	newRev.Branch = branch
-	newRev.lastUpdate = npr.lastUpdate
-
-	newRev.Children = make(map[string][]Revision)
-	for entryName, childrenEntry := range branch.GetLatest().GetAllChildren() {
-		newRev.Children[entryName] = append(newRev.Children[entryName], childrenEntry...)
-	}
-
-	newRev.Finalize(false)
-
-	log.Debugw("update-data-complete", log.Fields{"updated": newRev.Config.Data, "provided": data})
-
-	return &newRev
-}
-
-// UpdateChildren will refresh the list of children with the provided ones
-// It will carefully go through the list and ensure that no child is lost
-func (npr *NonPersistedRevision) UpdateChildren(ctx context.Context, name string, children []Revision, branch *Branch) Revision {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-
-	// Construct a new revision based on the current one
-	updatedRev := &NonPersistedRevision{}
-	updatedRev.Config = NewDataRevision(npr.Root, npr.Config.Data)
-	updatedRev.Hash = npr.Hash
-	updatedRev.Branch = branch
-	updatedRev.Name = npr.Name
-	updatedRev.lastUpdate = npr.lastUpdate
-
-	updatedRev.Children = make(map[string][]Revision)
-	for entryName, childrenEntry := range branch.GetLatest().GetAllChildren() {
-		updatedRev.Children[entryName] = append(updatedRev.Children[entryName], childrenEntry...)
-	}
-
-	var updatedChildren []Revision
-
-	// Verify if the map contains already contains an entry matching the name value
-	// If so, we need to retain the contents of that entry and merge them with the provided children revision list
-	if existingChildren := branch.GetLatest().GetChildren(name); existingChildren != nil {
-		// Construct a map of unique child names with the respective index value
-		// for the children in the existing revision as well as the new ones
-		existingNames := make(map[string]int)
-		newNames := make(map[string]int)
-
-		for i, newChild := range children {
-			newNames[newChild.GetName()] = i
-		}
-
-		for i, existingChild := range existingChildren {
-			existingNames[existingChild.GetName()] = i
-
-			// If an existing entry is not in the new list, add it to the updated list, so it is not forgotten
-			if _, exists := newNames[existingChild.GetName()]; !exists {
-				updatedChildren = append(updatedChildren, existingChild)
-			}
-		}
-
-		log.Debugw("existing-children-names", log.Fields{"hash": npr.GetHash(), "names": existingNames})
-
-		// Merge existing and new children
-		for _, newChild := range children {
-			nameIndex, nameExists := existingNames[newChild.GetName()]
-
-			// Does the existing list contain a child with that name?
-			if nameExists {
-				// Check if the data has changed or not
-				if existingChildren[nameIndex].GetData().(proto.Message).String() != newChild.GetData().(proto.Message).String() {
-					log.Debugw("replacing-existing-child", log.Fields{
-						"old-hash": existingChildren[nameIndex].GetHash(),
-						"old-data": existingChildren[nameIndex].GetData(),
-						"new-hash": newChild.GetHash(),
-						"new-data": newChild.GetData(),
-					})
-
-					// replace entry
-					newChild.GetNode().SetRoot(existingChildren[nameIndex].GetNode().GetRoot())
-					updatedChildren = append(updatedChildren, newChild)
-				} else {
-					log.Debugw("keeping-existing-child", log.Fields{
-						"old-hash": existingChildren[nameIndex].GetHash(),
-						"old-data": existingChildren[nameIndex].GetData(),
-						"new-hash": newChild.GetHash(),
-						"new-data": newChild.GetData(),
-					})
-
-					// keep existing entry
-					updatedChildren = append(updatedChildren, existingChildren[nameIndex])
-				}
-			} else {
-				log.Debugw("adding-unknown-child", log.Fields{
-					"hash": newChild.GetHash(),
-					"data": newChild.GetData(),
-				})
-
-				// new entry ... just add it
-				updatedChildren = append(updatedChildren, newChild)
-			}
-		}
-
-		// Save children in new revision
-		updatedRev.SetChildren(name, updatedChildren)
-
-		updatedNames := make(map[string]int)
-		for i, updatedChild := range updatedChildren {
-			updatedNames[updatedChild.GetName()] = i
-		}
-
-		log.Debugw("updated-children-names", log.Fields{"hash": npr.GetHash(), "names": updatedNames})
-
-	} else {
-		// There are no children available, just save the provided ones
-		updatedRev.SetChildren(name, children)
-	}
-
-	updatedRev.Finalize(false)
-
-	return updatedRev
-}
-
-// UpdateAllChildren will replace the current list of children with the provided ones
-func (npr *NonPersistedRevision) UpdateAllChildren(children map[string][]Revision, branch *Branch) Revision {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-
-	newRev := npr
-	newRev.Config = npr.Config
-	newRev.Hash = npr.Hash
-	newRev.Branch = branch
-	newRev.Name = npr.Name
-	newRev.lastUpdate = npr.lastUpdate
-
-	newRev.Children = make(map[string][]Revision)
-	for entryName, childrenEntry := range children {
-		newRev.Children[entryName] = append(newRev.Children[entryName], childrenEntry...)
-	}
-	newRev.Finalize(false)
-
-	return newRev
-}
-
-// Drop is used to indicate when a revision is no longer required
-func (npr *NonPersistedRevision) Drop(txid string, includeConfig bool) {
-	log.Debugw("dropping-revision", log.Fields{"hash": npr.GetHash(), "name": npr.GetName()})
-}
-
-// ChildDrop will remove a child entry matching the provided parameters from the current revision
-func (npr *NonPersistedRevision) ChildDrop(childType string, childHash string) {
-	if childType != "" {
-		children := make([]Revision, len(npr.GetChildren(childType)))
-		copy(children, npr.GetChildren(childType))
-		for i, child := range children {
-			if child.GetHash() == childHash {
-				children = append(children[:i], children[i+1:]...)
-				npr.SetChildren(childType, children)
-				break
-			}
-		}
-	}
-}
-
-/// ChildDropByName will remove a child entry matching the type and name
-func (npr *NonPersistedRevision) ChildDropByName(childName string) {
-	// Extract device type
-	parts := strings.SplitN(childName, "/", 2)
-	childType := parts[0]
-
-	if childType != "" {
-		children := make([]Revision, len(npr.GetChildren(childType)))
-		copy(children, npr.GetChildren(childType))
-		for i, child := range children {
-			if child.GetName() == childName {
-				children = append(children[:i], children[i+1:]...)
-				npr.SetChildren(childType, children)
-				break
-			}
-		}
-	}
-}
-
-func (npr *NonPersistedRevision) SetLastUpdate(ts ...time.Time) {
-	npr.mutex.Lock()
-	defer npr.mutex.Unlock()
-
-	if ts != nil && len(ts) > 0 {
-		npr.lastUpdate = ts[0]
-	} else {
-		npr.lastUpdate = time.Now()
-	}
-}
-
-func (npr *NonPersistedRevision) GetLastUpdate() time.Time {
-	npr.mutex.RLock()
-	defer npr.mutex.RUnlock()
-
-	return npr.lastUpdate
-}
-
-func (npr *NonPersistedRevision) LoadFromPersistence(ctx context.Context, path string, txid string, blobs map[string]*kvstore.KVPair) []Revision {
-	// stub... required by interface
-	return nil
-}
-
-func (npr *NonPersistedRevision) SetupWatch(key string) {
-	// stub ... required by interface
-}
-
-func (npr *NonPersistedRevision) StorageDrop(txid string, includeConfig bool) {
-	// stub ... required by interface
-}
-
-func (npr *NonPersistedRevision) getVersion() int64 {
-	return -1
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/persisted_revision.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/persisted_revision.go
deleted file mode 100644
index 53d93b7..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/persisted_revision.go
+++ /dev/null
@@ -1,625 +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 model
-
-import (
-	"bytes"
-	"compress/gzip"
-	"context"
-	"github.com/golang/protobuf/proto"
-	"github.com/google/uuid"
-	"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"reflect"
-	"strings"
-	"sync"
-)
-
-// PersistedRevision holds information of revision meant to be saved in a persistent storage
-type PersistedRevision struct {
-	Revision
-	Compress bool
-
-	events       chan *kvstore.Event
-	kvStore      *Backend
-	mutex        sync.RWMutex
-	versionMutex sync.RWMutex
-	Version      int64
-	isStored     bool
-	isWatched    bool
-}
-
-type watchCache struct {
-	Cache sync.Map
-}
-
-var watchCacheInstance *watchCache
-var watchCacheOne sync.Once
-
-func Watches() *watchCache {
-	watchCacheOne.Do(func() {
-		watchCacheInstance = &watchCache{Cache: sync.Map{}}
-	})
-	return watchCacheInstance
-}
-
-// NewPersistedRevision creates a new instance of a PersistentRevision structure
-func NewPersistedRevision(branch *Branch, data interface{}, children map[string][]Revision) Revision {
-	pr := &PersistedRevision{}
-	pr.kvStore = branch.Node.GetRoot().KvStore
-	pr.Version = 1
-	pr.Revision = NewNonPersistedRevision(nil, branch, data, children)
-	return pr
-}
-
-func (pr *PersistedRevision) getVersion() int64 {
-	pr.versionMutex.RLock()
-	defer pr.versionMutex.RUnlock()
-	return pr.Version
-}
-
-func (pr *PersistedRevision) setVersion(version int64) {
-	pr.versionMutex.Lock()
-	defer pr.versionMutex.Unlock()
-	pr.Version = version
-}
-
-// Finalize is responsible of saving the revision in the persistent storage
-func (pr *PersistedRevision) Finalize(skipOnExist bool) {
-	pr.store(skipOnExist)
-}
-
-func (pr *PersistedRevision) store(skipOnExist bool) {
-	if pr.GetBranch().Txid != "" {
-		return
-	}
-
-	log.Debugw("ready-to-store-revision", log.Fields{"hash": pr.GetHash(), "name": pr.GetName(), "data": pr.GetData()})
-
-	// clone the revision data to avoid any race conditions with processes
-	// accessing the same data
-	cloned := proto.Clone(pr.GetConfig().Data.(proto.Message))
-
-	if blob, err := proto.Marshal(cloned); err != nil {
-		log.Errorw("problem-to-marshal", log.Fields{"error": err, "hash": pr.GetHash(), "name": pr.GetName(), "data": pr.GetData()})
-	} else {
-		if pr.Compress {
-			var b bytes.Buffer
-			w := gzip.NewWriter(&b)
-			w.Write(blob)
-			w.Close()
-			blob = b.Bytes()
-		}
-
-		GetRevCache().Set(pr.GetName(), pr)
-		if err := pr.kvStore.Put(pr.GetName(), blob); err != nil {
-			log.Warnw("problem-storing-revision", log.Fields{"error": err, "hash": pr.GetHash(), "name": pr.GetName(), "data": pr.GetConfig().Data})
-		} else {
-			log.Debugw("storing-revision", log.Fields{"hash": pr.GetHash(), "name": pr.GetName(), "data": pr.GetConfig().Data, "version": pr.getVersion()})
-			pr.isStored = true
-		}
-	}
-}
-
-func (pr *PersistedRevision) SetupWatch(key string) {
-	if key == "" {
-		log.Debugw("ignoring-watch", log.Fields{"key": key, "revision-hash": pr.GetHash()})
-		return
-	}
-
-	if _, exists := Watches().Cache.LoadOrStore(key+"-"+pr.GetHash(), struct{}{}); exists {
-		return
-	}
-
-	if pr.events == nil {
-		pr.events = make(chan *kvstore.Event)
-
-		log.Debugw("setting-watch-channel", log.Fields{"key": key, "revision-hash": pr.GetHash()})
-
-		pr.SetName(key)
-		pr.events = pr.kvStore.CreateWatch(key)
-	}
-
-	if !pr.isWatched {
-		pr.isWatched = true
-
-		log.Debugw("setting-watch-routine", log.Fields{"key": key, "revision-hash": pr.GetHash()})
-
-		// Start watching
-		go pr.startWatching()
-	}
-}
-
-func (pr *PersistedRevision) startWatching() {
-	log.Debugw("starting-watch", log.Fields{"key": pr.GetHash(), "watch": pr.GetName()})
-
-StopWatchLoop:
-	for {
-		latestRev := pr.GetBranch().GetLatest()
-
-		select {
-		case event, ok := <-pr.events:
-			if !ok {
-				log.Errorw("event-channel-failure: stopping watch loop", log.Fields{"key": latestRev.GetHash(), "watch": latestRev.GetName()})
-				break StopWatchLoop
-			}
-			log.Debugw("received-event", log.Fields{"type": event.EventType, "watch": latestRev.GetName()})
-
-			switch event.EventType {
-			case kvstore.DELETE:
-				log.Debugw("delete-from-memory", log.Fields{"key": latestRev.GetHash(), "watch": latestRev.GetName()})
-
-				// Remove reference from cache
-				GetRevCache().Delete(latestRev.GetName())
-
-				// Remove reference from parent
-				parent := pr.GetBranch().Node.GetRoot()
-				parent.GetBranch(NONE).Latest.ChildDropByName(latestRev.GetName())
-
-				break StopWatchLoop
-
-			case kvstore.PUT:
-				log.Debugw("update-in-memory", log.Fields{"key": latestRev.GetHash(), "watch": latestRev.GetName()})
-				if latestRev.getVersion() >= event.Version {
-					log.Debugw("skipping-matching-or-older-revision", log.Fields{
-						"watch":          latestRev.GetName(),
-						"watch-version":  event.Version,
-						"latest-version": latestRev.getVersion(),
-					})
-					continue
-				} else {
-					log.Debugw("watch-revision-is-newer", log.Fields{
-						"watch":          latestRev.GetName(),
-						"watch-version":  event.Version,
-						"latest-version": latestRev.getVersion(),
-					})
-				}
-
-				data := reflect.New(reflect.TypeOf(latestRev.GetData()).Elem())
-
-				if err := proto.Unmarshal(event.Value.([]byte), data.Interface().(proto.Message)); err != nil {
-					log.Errorw("failed-to-unmarshal-watch-data", log.Fields{"key": latestRev.GetHash(), "watch": latestRev.GetName(), "error": err})
-				} else {
-					log.Debugw("un-marshaled-watch-data", log.Fields{"key": latestRev.GetHash(), "watch": latestRev.GetName(), "data": data.Interface()})
-
-					var pathLock string
-					var blobs map[string]*kvstore.KVPair
-
-					// The watch reported new persistence data.
-					// Construct an object that will be used to update the memory
-					blobs = make(map[string]*kvstore.KVPair)
-					key, _ := kvstore.ToString(event.Key)
-					blobs[key] = &kvstore.KVPair{
-						Key:     key,
-						Value:   event.Value,
-						Session: "",
-						Lease:   0,
-						Version: event.Version,
-					}
-
-					if latestRev.GetNode().GetProxy() != nil {
-						//
-						// If a proxy exists for this revision, use it to lock access to the path
-						// and prevent simultaneous updates to the object in memory
-						//
-
-						//If the proxy already has a request in progress, then there is no need to process the watch
-						if latestRev.GetNode().GetProxy().GetOperation() != PROXY_NONE {
-							log.Debugw("operation-in-progress", log.Fields{
-								"key":       latestRev.GetHash(),
-								"path":      latestRev.GetNode().GetProxy().getFullPath(),
-								"operation": latestRev.GetNode().GetProxy().operation.String(),
-							})
-							continue
-						}
-
-						pathLock, _ = latestRev.GetNode().GetProxy().parseForControlledPath(latestRev.GetNode().GetProxy().getFullPath())
-
-						// Reserve the path to prevent others to modify while we reload from persistence
-						latestRev.GetNode().GetProxy().GetRoot().KvStore.Client.Reserve(pathLock+"_", uuid.New().String(), ReservationTTL)
-						latestRev.GetNode().GetProxy().SetOperation(PROXY_WATCH)
-
-						// Load changes and apply to memory
-						latestRev.LoadFromPersistence(context.Background(), latestRev.GetName(), "", blobs)
-
-						// Release path
-						latestRev.GetNode().GetProxy().GetRoot().KvStore.Client.ReleaseReservation(pathLock + "_")
-
-					} else {
-						// This block should be reached only if coming from a non-proxied request
-						log.Debugw("revision-with-no-proxy", log.Fields{"key": latestRev.GetHash(), "watch": latestRev.GetName()})
-
-						// Load changes and apply to memory
-						latestRev.LoadFromPersistence(context.Background(), latestRev.GetName(), "", blobs)
-					}
-				}
-
-			default:
-				log.Debugw("unhandled-event", log.Fields{"key": latestRev.GetHash(), "watch": latestRev.GetName(), "type": event.EventType})
-			}
-		}
-	}
-
-	Watches().Cache.Delete(pr.GetName() + "-" + pr.GetHash())
-
-	log.Debugw("exiting-watch", log.Fields{"key": pr.GetHash(), "watch": pr.GetName()})
-}
-
-// UpdateData modifies the information in the data model and saves it in the persistent storage
-func (pr *PersistedRevision) UpdateData(ctx context.Context, data interface{}, branch *Branch) Revision {
-	log.Debugw("updating-persisted-data", log.Fields{"hash": pr.GetHash()})
-
-	newNPR := pr.Revision.UpdateData(ctx, data, branch)
-
-	newPR := &PersistedRevision{
-		Revision:  newNPR,
-		Compress:  pr.Compress,
-		kvStore:   pr.kvStore,
-		events:    pr.events,
-		Version:   pr.getVersion(),
-		isWatched: pr.isWatched,
-	}
-
-	if newPR.GetHash() != pr.GetHash() {
-		newPR.isStored = false
-		pr.Drop(branch.Txid, false)
-		pr.Drop(branch.Txid, false)
-	} else {
-		newPR.isStored = true
-	}
-
-	return newPR
-}
-
-// UpdateChildren modifies the children of a revision and of a specific component and saves it in the persistent storage
-func (pr *PersistedRevision) UpdateChildren(ctx context.Context, name string, children []Revision, branch *Branch) Revision {
-	log.Debugw("updating-persisted-children", log.Fields{"hash": pr.GetHash()})
-
-	newNPR := pr.Revision.UpdateChildren(ctx, name, children, branch)
-
-	newPR := &PersistedRevision{
-		Revision:  newNPR,
-		Compress:  pr.Compress,
-		kvStore:   pr.kvStore,
-		events:    pr.events,
-		Version:   pr.getVersion(),
-		isWatched: pr.isWatched,
-	}
-
-	if newPR.GetHash() != pr.GetHash() {
-		newPR.isStored = false
-		pr.Drop(branch.Txid, false)
-	} else {
-		newPR.isStored = true
-	}
-
-	return newPR
-}
-
-// UpdateAllChildren modifies the children for all components of a revision and saves it in the peristent storage
-func (pr *PersistedRevision) UpdateAllChildren(children map[string][]Revision, branch *Branch) Revision {
-	log.Debugw("updating-all-persisted-children", log.Fields{"hash": pr.GetHash()})
-
-	newNPR := pr.Revision.UpdateAllChildren(children, branch)
-
-	newPR := &PersistedRevision{
-		Revision:  newNPR,
-		Compress:  pr.Compress,
-		kvStore:   pr.kvStore,
-		events:    pr.events,
-		Version:   pr.getVersion(),
-		isWatched: pr.isWatched,
-	}
-
-	if newPR.GetHash() != pr.GetHash() {
-		newPR.isStored = false
-		pr.Drop(branch.Txid, false)
-	} else {
-		newPR.isStored = true
-	}
-
-	return newPR
-}
-
-// Drop takes care of eliminating a revision hash that is no longer needed
-// and its associated config when required
-func (pr *PersistedRevision) Drop(txid string, includeConfig bool) {
-	pr.Revision.Drop(txid, includeConfig)
-}
-
-// Drop takes care of eliminating a revision hash that is no longer needed
-// and its associated config when required
-func (pr *PersistedRevision) StorageDrop(txid string, includeConfig bool) {
-	log.Debugw("dropping-revision", log.Fields{"txid": txid, "hash": pr.GetHash(), "config-hash": pr.GetConfig().Hash})
-
-	pr.mutex.Lock()
-	defer pr.mutex.Unlock()
-	if pr.kvStore != nil && txid == "" {
-		if pr.isStored {
-			if pr.isWatched {
-				pr.kvStore.DeleteWatch(pr.GetName(), pr.events)
-				pr.isWatched = false
-			}
-
-			if err := pr.kvStore.Delete(pr.GetName()); err != nil {
-				log.Errorw("failed-to-remove-revision", log.Fields{"hash": pr.GetHash(), "error": err.Error()})
-			} else {
-				pr.isStored = false
-			}
-		}
-
-	} else {
-		if includeConfig {
-			log.Debugw("attempted-to-remove-transacted-revision-config", log.Fields{"hash": pr.GetConfig().Hash, "txid": txid})
-		}
-		log.Debugw("attempted-to-remove-transacted-revision", log.Fields{"hash": pr.GetHash(), "txid": txid})
-	}
-
-	pr.Revision.Drop(txid, includeConfig)
-}
-
-// verifyPersistedEntry validates if the provided data is available or not in memory and applies updates as required
-func (pr *PersistedRevision) verifyPersistedEntry(ctx context.Context, data interface{}, typeName string, keyName string,
-	keyValue string, txid string, version int64) (response Revision) {
-	// Parent which holds the current node entry
-	parent := pr.GetBranch().Node.GetRoot()
-
-	// Get a copy of the parent's children
-	children := make([]Revision, len(parent.GetBranch(NONE).Latest.GetChildren(typeName)))
-	copy(children, parent.GetBranch(NONE).Latest.GetChildren(typeName))
-
-	// Verify if a child with the provided key value can be found
-	if childIdx, childRev := pr.GetNode().findRevByKey(children, keyName, keyValue); childRev != nil {
-		// A child matching the provided key exists in memory
-		// Verify if the data differs from what was retrieved from persistence
-		// Also check if we are treating a newer revision of the data or not
-		if childRev.GetData().(proto.Message).String() != data.(proto.Message).String() && childRev.getVersion() < version {
-			log.Debugw("revision-data-is-different", log.Fields{
-				"key":               childRev.GetHash(),
-				"name":              childRev.GetName(),
-				"data":              childRev.GetData(),
-				"in-memory-version": childRev.getVersion(),
-				"persisted-version": version,
-			})
-
-			//
-			// Data has changed; replace the child entry and update the parent revision
-			//
-
-			// BEGIN Lock child -- prevent any incoming changes
-			childRev.GetBranch().LatestLock.Lock()
-
-			// Update child
-			updatedChildRev := childRev.UpdateData(ctx, data, childRev.GetBranch())
-
-			updatedChildRev.GetNode().SetProxy(childRev.GetNode().GetProxy())
-			updatedChildRev.SetupWatch(updatedChildRev.GetName())
-			updatedChildRev.SetLastUpdate()
-			updatedChildRev.(*PersistedRevision).setVersion(version)
-
-			// Update cache
-			GetRevCache().Set(updatedChildRev.GetName(), updatedChildRev)
-			childRev.Drop(txid, false)
-
-			childRev.GetBranch().LatestLock.Unlock()
-			// END lock child
-
-			// Update child entry
-			children[childIdx] = updatedChildRev
-
-			// BEGIN lock parent -- Update parent
-			parent.GetBranch(NONE).LatestLock.Lock()
-
-			updatedRev := parent.GetBranch(NONE).GetLatest().UpdateChildren(ctx, typeName, children, parent.GetBranch(NONE))
-			parent.GetBranch(NONE).Node.makeLatest(parent.GetBranch(NONE), updatedRev, nil)
-
-			parent.GetBranch(NONE).LatestLock.Unlock()
-			// END lock parent
-
-			// Drop the previous child revision
-			parent.GetBranch(NONE).Latest.ChildDrop(typeName, childRev.GetHash())
-
-			if updatedChildRev != nil {
-				log.Debugw("verify-persisted-entry--adding-child", log.Fields{
-					"key":  updatedChildRev.GetHash(),
-					"name": updatedChildRev.GetName(),
-					"data": updatedChildRev.GetData(),
-				})
-				response = updatedChildRev
-			}
-		} else {
-			if childRev != nil {
-				log.Debugw("keeping-revision-data", log.Fields{
-					"key":                 childRev.GetHash(),
-					"name":                childRev.GetName(),
-					"data":                childRev.GetData(),
-					"in-memory-version":   childRev.getVersion(),
-					"persistence-version": version,
-				})
-
-				// Update timestamp to reflect when it was last read and to reset tracked timeout
-				childRev.SetLastUpdate()
-				if childRev.getVersion() < version {
-					childRev.(*PersistedRevision).setVersion(version)
-				}
-				GetRevCache().Set(childRev.GetName(), childRev)
-				response = childRev
-			}
-		}
-
-	} else {
-		// There is no available child with that key value.
-		// Create a new child and update the parent revision.
-		log.Debugw("no-such-revision-entry", log.Fields{
-			"key":     keyValue,
-			"name":    typeName,
-			"data":    data,
-			"version": version,
-		})
-
-		// BEGIN child lock
-		pr.GetBranch().LatestLock.Lock()
-
-		// Construct a new child node with the retrieved persistence data
-		childRev = pr.GetBranch().Node.MakeNode(data, txid).Latest(txid)
-
-		// We need to start watching this entry for future changes
-		childRev.SetName(typeName + "/" + keyValue)
-		childRev.SetupWatch(childRev.GetName())
-		childRev.(*PersistedRevision).setVersion(version)
-
-		// Add entry to cache
-		GetRevCache().Set(childRev.GetName(), childRev)
-
-		pr.GetBranch().LatestLock.Unlock()
-		// END child lock
-
-		//
-		// Add the child to the parent revision
-		//
-
-		// BEGIN parent lock
-		parent.GetBranch(NONE).LatestLock.Lock()
-		children = append(children, childRev)
-		updatedRev := parent.GetBranch(NONE).GetLatest().UpdateChildren(ctx, typeName, children, parent.GetBranch(NONE))
-		updatedRev.GetNode().SetProxy(parent.GetBranch(NONE).Node.GetProxy())
-		parent.GetBranch(NONE).Node.makeLatest(parent.GetBranch(NONE), updatedRev, nil)
-		parent.GetBranch(NONE).LatestLock.Unlock()
-		// END parent lock
-
-		// Child entry is valid and can be included in the response object
-		if childRev != nil {
-			log.Debugw("adding-revision-to-response", log.Fields{
-				"key":  childRev.GetHash(),
-				"name": childRev.GetName(),
-				"data": childRev.GetData(),
-			})
-			response = childRev
-		}
-	}
-
-	return response
-}
-
-// LoadFromPersistence retrieves data from kv store at the specified location and refreshes the memory
-// by adding missing entries, updating changed entries and ignoring unchanged ones
-func (pr *PersistedRevision) LoadFromPersistence(ctx context.Context, path string, txid string, blobs map[string]*kvstore.KVPair) []Revision {
-	pr.mutex.Lock()
-	defer pr.mutex.Unlock()
-
-	log.Debugw("loading-from-persistence", log.Fields{"path": path, "txid": txid})
-
-	var response []Revision
-
-	for strings.HasPrefix(path, "/") {
-		path = path[1:]
-	}
-
-	if pr.kvStore != nil && path != "" {
-		if blobs == nil || len(blobs) == 0 {
-			log.Debugw("retrieve-from-kv", log.Fields{"path": path, "txid": txid})
-			blobs, _ = pr.kvStore.List(path)
-		}
-
-		partition := strings.SplitN(path, "/", 2)
-		name := partition[0]
-
-		var nodeType interface{}
-		if len(partition) < 2 {
-			path = ""
-			nodeType = pr.GetBranch().Node.Type
-		} else {
-			path = partition[1]
-			nodeType = pr.GetBranch().Node.GetRoot().Type
-		}
-
-		field := ChildrenFields(nodeType)[name]
-
-		if field != nil && field.IsContainer {
-			log.Debugw("parsing-data-blobs", log.Fields{
-				"path": path,
-				"name": name,
-				"size": len(blobs),
-			})
-
-			for _, blob := range blobs {
-				output := blob.Value.([]byte)
-
-				data := reflect.New(field.ClassType.Elem())
-
-				if err := proto.Unmarshal(output, data.Interface().(proto.Message)); err != nil {
-					log.Errorw("failed-to-unmarshal", log.Fields{
-						"path":  path,
-						"txid":  txid,
-						"error": err,
-					})
-				} else if path == "" {
-					if field.Key != "" {
-						log.Debugw("no-path-with-container-key", log.Fields{
-							"path": path,
-							"txid": txid,
-							"data": data.Interface(),
-						})
-
-						// Retrieve the key identifier value from the data structure
-						// based on the field's key attribute
-						_, key := GetAttributeValue(data.Interface(), field.Key, 0)
-
-						if entry := pr.verifyPersistedEntry(ctx, data.Interface(), name, field.Key, key.String(), txid, blob.Version); entry != nil {
-							response = append(response, entry)
-						}
-					} else {
-						log.Debugw("path-with-no-container-key", log.Fields{
-							"path": path,
-							"txid": txid,
-							"data": data.Interface(),
-						})
-					}
-
-				} else if field.Key != "" {
-					log.Debugw("path-with-container-key", log.Fields{
-						"path": path,
-						"txid": txid,
-						"data": data.Interface(),
-					})
-					// The request is for a specific entry/id
-					partition := strings.SplitN(path, "/", 2)
-					key := partition[0]
-					if len(partition) < 2 {
-						path = ""
-					} else {
-						path = partition[1]
-					}
-					keyValue := field.KeyFromStr(key)
-
-					if entry := pr.verifyPersistedEntry(ctx, data.Interface(), name, field.Key, keyValue.(string), txid, blob.Version); entry != nil {
-						response = append(response, entry)
-					}
-				}
-			}
-
-			log.Debugw("no-more-data-blobs", log.Fields{"path": path, "name": name})
-		} else {
-			log.Debugw("cannot-process-field", log.Fields{
-				"type": pr.GetBranch().Node.Type,
-				"name": name,
-			})
-		}
-	}
-
-	return response
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/profiling.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/profiling.go
deleted file mode 100644
index f8e9f7a..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/profiling.go
+++ /dev/null
@@ -1,122 +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 model
-
-import (
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"sync"
-)
-
-// Profiling is used to store performance details collected at runtime
-type profiling struct {
-	sync.RWMutex
-	DatabaseRetrieveTime  float64
-	DatabaseRetrieveCount int
-	InMemoryModelTime     float64
-	InMemoryModelCount    int
-	InMemoryProcessTime   float64
-	DatabaseStoreTime     float64
-	InMemoryLockTime      float64
-	InMemoryLockCount     int
-}
-
-var profilingInstance *profiling
-var profilingOnce sync.Once
-
-// GetProfiling returns a singleton instance of the Profiling structure
-func GetProfiling() *profiling {
-	profilingOnce.Do(func() {
-		profilingInstance = &profiling{}
-	})
-	return profilingInstance
-}
-
-// AddToDatabaseRetrieveTime appends a time period to retrieve data from the database
-func (p *profiling) AddToDatabaseRetrieveTime(period float64) {
-	p.Lock()
-	defer p.Unlock()
-
-	p.DatabaseRetrieveTime += period
-	p.DatabaseRetrieveCount++
-}
-
-// AddToInMemoryModelTime appends a time period to construct/deconstruct data in memory
-func (p *profiling) AddToInMemoryModelTime(period float64) {
-	p.Lock()
-	defer p.Unlock()
-
-	p.InMemoryModelTime += period
-	p.InMemoryModelCount++
-}
-
-// AddToInMemoryProcessTime appends a time period to process data
-func (p *profiling) AddToInMemoryProcessTime(period float64) {
-	p.Lock()
-	defer p.Unlock()
-
-	p.InMemoryProcessTime += period
-}
-
-// AddToDatabaseStoreTime appends a time period to store data in the database
-func (p *profiling) AddToDatabaseStoreTime(period float64) {
-	p.Lock()
-	defer p.Unlock()
-
-	p.DatabaseStoreTime += period
-}
-
-// AddToInMemoryLockTime appends a time period when a code block was locked
-func (p *profiling) AddToInMemoryLockTime(period float64) {
-	p.Lock()
-	defer p.Unlock()
-
-	p.InMemoryLockTime += period
-	p.InMemoryLockCount++
-}
-
-// Reset initializes the profile counters
-func (p *profiling) Reset() {
-	p.Lock()
-	defer p.Unlock()
-
-	p.DatabaseRetrieveTime = 0
-	p.DatabaseRetrieveCount = 0
-	p.InMemoryModelTime = 0
-	p.InMemoryModelCount = 0
-	p.InMemoryProcessTime = 0
-	p.DatabaseStoreTime = 0
-	p.InMemoryLockTime = 0
-	p.InMemoryLockCount = 0
-}
-
-// Report will provide the current profile counter status
-func (p *profiling) Report() {
-	p.Lock()
-	defer p.Unlock()
-
-	log.Infof("[ Profiling Report ]")
-	log.Infof("Database Retrieval : %f", p.DatabaseRetrieveTime)
-	log.Infof("Database Retrieval Count : %d", p.DatabaseRetrieveCount)
-	log.Infof("Avg Database Retrieval : %f", p.DatabaseRetrieveTime/float64(p.DatabaseRetrieveCount))
-	log.Infof("In-Memory Modeling : %f", p.InMemoryModelTime)
-	log.Infof("In-Memory Modeling Count: %d", p.InMemoryModelCount)
-	log.Infof("Avg In-Memory Modeling : %f", p.InMemoryModelTime/float64(p.InMemoryModelCount))
-	log.Infof("In-Memory Locking : %f", p.InMemoryLockTime)
-	log.Infof("In-Memory Locking Count: %d", p.InMemoryLockCount)
-	log.Infof("Avg In-Memory Locking : %f", p.InMemoryLockTime/float64(p.InMemoryLockCount))
-
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/proxy.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/proxy.go
deleted file mode 100644
index b5378fe..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/proxy.go
+++ /dev/null
@@ -1,598 +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 model
-
-import (
-	"context"
-	"crypto/md5"
-	"errors"
-	"fmt"
-	"github.com/google/uuid"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"reflect"
-	"runtime"
-	"strings"
-	"sync"
-)
-
-// OperationContext holds details on the information used during an operation
-type OperationContext struct {
-	Path      string
-	Data      interface{}
-	FieldName string
-	ChildKey  string
-}
-
-// NewOperationContext instantiates a new OperationContext structure
-func NewOperationContext(path string, data interface{}, fieldName string, childKey string) *OperationContext {
-	oc := &OperationContext{
-		Path:      path,
-		Data:      data,
-		FieldName: fieldName,
-		ChildKey:  childKey,
-	}
-	return oc
-}
-
-// Update applies new data to the context structure
-func (oc *OperationContext) Update(data interface{}) *OperationContext {
-	oc.Data = data
-	return oc
-}
-
-// Proxy holds the information for a specific location with the data model
-type Proxy struct {
-	mutex      sync.RWMutex
-	Root       *root
-	Node       *node
-	ParentNode *node
-	Path       string
-	FullPath   string
-	Exclusive  bool
-	Callbacks  map[CallbackType]map[string]*CallbackTuple
-	operation  ProxyOperation
-}
-
-// NewProxy instantiates a new proxy to a specific location
-func NewProxy(root *root, node *node, parentNode *node, path string, fullPath string, exclusive bool) *Proxy {
-	callbacks := make(map[CallbackType]map[string]*CallbackTuple)
-	if fullPath == "/" {
-		fullPath = ""
-	}
-	p := &Proxy{
-		Root:       root,
-		Node:       node,
-		ParentNode: parentNode,
-		Exclusive:  exclusive,
-		Path:       path,
-		FullPath:   fullPath,
-		Callbacks:  callbacks,
-	}
-	return p
-}
-
-// GetRoot returns the root attribute of the proxy
-func (p *Proxy) GetRoot() *root {
-	return p.Root
-}
-
-// getPath returns the path attribute of the proxy
-func (p *Proxy) getPath() string {
-	return p.Path
-}
-
-// getFullPath returns the full path attribute of the proxy
-func (p *Proxy) getFullPath() string {
-	return p.FullPath
-}
-
-// getCallbacks returns the full list of callbacks associated to the proxy
-func (p *Proxy) getCallbacks(callbackType CallbackType) map[string]*CallbackTuple {
-	p.mutex.RLock()
-	defer p.mutex.RUnlock()
-
-	if p != nil {
-		if cb, exists := p.Callbacks[callbackType]; exists {
-			return cb
-		}
-	} else {
-		log.Debugw("proxy-is-nil", log.Fields{"callback-type": callbackType.String()})
-	}
-	return nil
-}
-
-// getCallback returns a specific callback matching the type and function hash
-func (p *Proxy) getCallback(callbackType CallbackType, funcHash string) *CallbackTuple {
-	p.mutex.Lock()
-	defer p.mutex.Unlock()
-	if tuple, exists := p.Callbacks[callbackType][funcHash]; exists {
-		return tuple
-	}
-	return nil
-}
-
-// setCallbacks applies a callbacks list to a type
-func (p *Proxy) setCallbacks(callbackType CallbackType, callbacks map[string]*CallbackTuple) {
-	p.mutex.Lock()
-	defer p.mutex.Unlock()
-	p.Callbacks[callbackType] = callbacks
-}
-
-// setCallback applies a callback to a type and hash value
-func (p *Proxy) setCallback(callbackType CallbackType, funcHash string, tuple *CallbackTuple) {
-	p.mutex.Lock()
-	defer p.mutex.Unlock()
-	p.Callbacks[callbackType][funcHash] = tuple
-}
-
-// DeleteCallback removes a callback matching the type and hash
-func (p *Proxy) DeleteCallback(callbackType CallbackType, funcHash string) {
-	p.mutex.Lock()
-	defer p.mutex.Unlock()
-	delete(p.Callbacks[callbackType], funcHash)
-}
-
-// CallbackType is an enumerated value to express when a callback should be executed
-type ProxyOperation uint8
-
-// Enumerated list of callback types
-const (
-	PROXY_NONE ProxyOperation = iota
-	PROXY_GET
-	PROXY_LIST
-	PROXY_ADD
-	PROXY_UPDATE
-	PROXY_REMOVE
-	PROXY_CREATE
-	PROXY_WATCH
-)
-
-var proxyOperationTypes = []string{
-	"PROXY_NONE",
-	"PROXY_GET",
-	"PROXY_LIST",
-	"PROXY_ADD",
-	"PROXY_UPDATE",
-	"PROXY_REMOVE",
-	"PROXY_CREATE",
-	"PROXY_WATCH",
-}
-
-func (t ProxyOperation) String() string {
-	return proxyOperationTypes[t]
-}
-
-func (p *Proxy) GetOperation() ProxyOperation {
-	p.mutex.RLock()
-	defer p.mutex.RUnlock()
-	return p.operation
-}
-
-func (p *Proxy) SetOperation(operation ProxyOperation) {
-	p.mutex.Lock()
-	defer p.mutex.Unlock()
-	p.operation = operation
-}
-
-// parseForControlledPath verifies if a proxy path matches a pattern
-// for locations that need to be access controlled.
-func (p *Proxy) parseForControlledPath(path string) (pathLock string, controlled bool) {
-	// TODO: Add other path prefixes that may need control
-	if strings.HasPrefix(path, "/devices") ||
-		strings.HasPrefix(path, "/logical_devices") ||
-		strings.HasPrefix(path, "/adapters") {
-
-		split := strings.SplitN(path, "/", -1)
-		switch len(split) {
-		case 2:
-			controlled = false
-			pathLock = ""
-			break
-		case 3:
-			fallthrough
-		default:
-			pathLock = fmt.Sprintf("%s/%s", split[1], split[2])
-			controlled = true
-		}
-	}
-	return pathLock, controlled
-}
-
-// List will retrieve information from the data model at the specified path location
-// A list operation will force access to persistence storage
-func (p *Proxy) List(ctx context.Context, path string, depth int, deep bool, txid string) interface{} {
-	var effectivePath string
-	if path == "/" {
-		effectivePath = p.getFullPath()
-	} else {
-		effectivePath = p.getFullPath() + path
-	}
-
-	pathLock, controlled := p.parseForControlledPath(effectivePath)
-
-	p.SetOperation(PROXY_LIST)
-	defer p.SetOperation(PROXY_NONE)
-
-	log.Debugw("proxy-list", log.Fields{
-		"path":       path,
-		"effective":  effectivePath,
-		"pathLock":   pathLock,
-		"controlled": controlled,
-		"operation":  p.GetOperation(),
-	})
-
-	rv := p.GetRoot().List(ctx, path, "", depth, deep, txid)
-
-	return rv
-}
-
-// Get will retrieve information from the data model at the specified path location
-func (p *Proxy) Get(ctx context.Context, path string, depth int, deep bool, txid string) interface{} {
-	var effectivePath string
-	if path == "/" {
-		effectivePath = p.getFullPath()
-	} else {
-		effectivePath = p.getFullPath() + path
-	}
-
-	pathLock, controlled := p.parseForControlledPath(effectivePath)
-
-	p.SetOperation(PROXY_GET)
-	defer p.SetOperation(PROXY_NONE)
-
-	log.Debugw("proxy-get", log.Fields{
-		"path":       path,
-		"effective":  effectivePath,
-		"pathLock":   pathLock,
-		"controlled": controlled,
-		"operation":  p.GetOperation(),
-	})
-
-	rv := p.GetRoot().Get(ctx, path, "", depth, deep, txid)
-
-	return rv
-}
-
-// Update will modify information in the data model at the specified location with the provided data
-func (p *Proxy) Update(ctx context.Context, path string, data interface{}, strict bool, txid string) interface{} {
-	if !strings.HasPrefix(path, "/") {
-		log.Errorf("invalid path: %s", path)
-		return nil
-	}
-	var fullPath string
-	var effectivePath string
-	if path == "/" {
-		fullPath = p.getPath()
-		effectivePath = p.getFullPath()
-	} else {
-		fullPath = p.getPath() + path
-		effectivePath = p.getFullPath() + path
-	}
-
-	pathLock, controlled := p.parseForControlledPath(effectivePath)
-
-	p.SetOperation(PROXY_UPDATE)
-	defer p.SetOperation(PROXY_NONE)
-
-	log.Debugw("proxy-update", log.Fields{
-		"path":       path,
-		"effective":  effectivePath,
-		"full":       fullPath,
-		"pathLock":   pathLock,
-		"controlled": controlled,
-		"operation":  p.GetOperation(),
-	})
-
-	if p.GetRoot().KvStore != nil {
-		p.GetRoot().KvStore.Client.Reserve(pathLock+"_", uuid.New().String(), ReservationTTL)
-		defer p.GetRoot().KvStore.Client.ReleaseReservation(pathLock + "_")
-	}
-
-	result := p.GetRoot().Update(ctx, fullPath, data, strict, txid, nil)
-
-	if result != nil {
-		return result.GetData()
-	}
-
-	return nil
-}
-
-// AddWithID will insert new data at specified location.
-// This method also allows the user to specify the ID of the data entry to ensure
-// that access control is active while inserting the information.
-func (p *Proxy) AddWithID(ctx context.Context, path string, id string, data interface{}, txid string) interface{} {
-	if !strings.HasPrefix(path, "/") {
-		log.Errorf("invalid path: %s", path)
-		return nil
-	}
-	var fullPath string
-	var effectivePath string
-	if path == "/" {
-		fullPath = p.getPath()
-		effectivePath = p.getFullPath()
-	} else {
-		fullPath = p.getPath() + path
-		effectivePath = p.getFullPath() + path + "/" + id
-	}
-
-	pathLock, controlled := p.parseForControlledPath(effectivePath)
-
-	p.SetOperation(PROXY_ADD)
-	defer p.SetOperation(PROXY_NONE)
-
-	log.Debugw("proxy-add-with-id", log.Fields{
-		"path":       path,
-		"effective":  effectivePath,
-		"full":       fullPath,
-		"pathLock":   pathLock,
-		"controlled": controlled,
-		"operation":  p.GetOperation(),
-	})
-
-	if p.GetRoot().KvStore != nil {
-		p.GetRoot().KvStore.Client.Reserve(pathLock+"_", uuid.New().String(), ReservationTTL)
-		defer p.GetRoot().KvStore.Client.ReleaseReservation(pathLock + "_")
-	}
-
-	result := p.GetRoot().Add(ctx, fullPath, data, txid, nil)
-
-	if result != nil {
-		return result.GetData()
-	}
-
-	return nil
-}
-
-// Add will insert new data at specified location.
-func (p *Proxy) Add(ctx context.Context, path string, data interface{}, txid string) interface{} {
-	if !strings.HasPrefix(path, "/") {
-		log.Errorf("invalid path: %s", path)
-		return nil
-	}
-	var fullPath string
-	var effectivePath string
-	if path == "/" {
-		fullPath = p.getPath()
-		effectivePath = p.getFullPath()
-	} else {
-		fullPath = p.getPath() + path
-		effectivePath = p.getFullPath() + path
-	}
-
-	pathLock, controlled := p.parseForControlledPath(effectivePath)
-
-	p.SetOperation(PROXY_ADD)
-	defer p.SetOperation(PROXY_NONE)
-
-	log.Debugw("proxy-add", log.Fields{
-		"path":       path,
-		"effective":  effectivePath,
-		"full":       fullPath,
-		"pathLock":   pathLock,
-		"controlled": controlled,
-		"operation":  p.GetOperation(),
-	})
-
-	if p.GetRoot().KvStore != nil {
-		p.GetRoot().KvStore.Client.Reserve(pathLock+"_", uuid.New().String(), ReservationTTL)
-		defer p.GetRoot().KvStore.Client.ReleaseReservation(pathLock + "_")
-	}
-
-	result := p.GetRoot().Add(ctx, fullPath, data, txid, nil)
-
-	if result != nil {
-		return result.GetData()
-	}
-
-	return nil
-}
-
-// Remove will delete an entry at the specified location
-func (p *Proxy) Remove(ctx context.Context, path string, txid string) interface{} {
-	if !strings.HasPrefix(path, "/") {
-		log.Errorf("invalid path: %s", path)
-		return nil
-	}
-	var fullPath string
-	var effectivePath string
-	if path == "/" {
-		fullPath = p.getPath()
-		effectivePath = p.getFullPath()
-	} else {
-		fullPath = p.getPath() + path
-		effectivePath = p.getFullPath() + path
-	}
-
-	pathLock, controlled := p.parseForControlledPath(effectivePath)
-
-	p.SetOperation(PROXY_REMOVE)
-	defer p.SetOperation(PROXY_NONE)
-
-	log.Debugw("proxy-remove", log.Fields{
-		"path":       path,
-		"effective":  effectivePath,
-		"full":       fullPath,
-		"pathLock":   pathLock,
-		"controlled": controlled,
-		"operation":  p.GetOperation(),
-	})
-
-	if p.GetRoot().KvStore != nil {
-		p.GetRoot().KvStore.Client.Reserve(pathLock+"_", uuid.New().String(), ReservationTTL)
-		defer p.GetRoot().KvStore.Client.ReleaseReservation(pathLock + "_")
-	}
-
-	result := p.GetRoot().Remove(ctx, fullPath, txid, nil)
-
-	if result != nil {
-		return result.GetData()
-	}
-
-	return nil
-}
-
-// CreateProxy to interact with specific path directly
-func (p *Proxy) CreateProxy(ctx context.Context, path string, exclusive bool) *Proxy {
-	if !strings.HasPrefix(path, "/") {
-		log.Errorf("invalid path: %s", path)
-		return nil
-	}
-
-	var fullPath string
-	var effectivePath string
-	if path == "/" {
-		fullPath = p.getPath()
-		effectivePath = p.getFullPath()
-	} else {
-		fullPath = p.getPath() + path
-		effectivePath = p.getFullPath() + path
-	}
-
-	pathLock, controlled := p.parseForControlledPath(effectivePath)
-
-	p.SetOperation(PROXY_CREATE)
-	defer p.SetOperation(PROXY_NONE)
-
-	log.Debugw("proxy-create", log.Fields{
-		"path":       path,
-		"effective":  effectivePath,
-		"full":       fullPath,
-		"pathLock":   pathLock,
-		"controlled": controlled,
-		"operation":  p.GetOperation(),
-	})
-
-	if p.GetRoot().KvStore != nil {
-		p.GetRoot().KvStore.Client.Reserve(pathLock+"_", uuid.New().String(), ReservationTTL)
-		defer p.GetRoot().KvStore.Client.ReleaseReservation(pathLock + "_")
-	}
-
-	return p.GetRoot().CreateProxy(ctx, fullPath, exclusive)
-}
-
-// OpenTransaction creates a new transaction branch to isolate operations made to the data model
-func (p *Proxy) OpenTransaction() *Transaction {
-	txid := p.GetRoot().MakeTxBranch()
-	return NewTransaction(p, txid)
-}
-
-// commitTransaction will apply and merge modifications made in the transaction branch to the data model
-func (p *Proxy) commitTransaction(txid string) {
-	p.GetRoot().FoldTxBranch(txid)
-}
-
-// cancelTransaction will terminate a transaction branch along will all changes within it
-func (p *Proxy) cancelTransaction(txid string) {
-	p.GetRoot().DeleteTxBranch(txid)
-}
-
-// CallbackFunction is a type used to define callback functions
-type CallbackFunction func(args ...interface{}) interface{}
-
-// CallbackTuple holds the function and arguments details of a callback
-type CallbackTuple struct {
-	callback CallbackFunction
-	args     []interface{}
-}
-
-// Execute will process the a callback with its provided arguments
-func (tuple *CallbackTuple) Execute(contextArgs []interface{}) interface{} {
-	args := []interface{}{}
-
-	for _, ta := range tuple.args {
-		args = append(args, ta)
-	}
-
-	if contextArgs != nil {
-		for _, ca := range contextArgs {
-			args = append(args, ca)
-		}
-	}
-
-	return tuple.callback(args...)
-}
-
-// RegisterCallback associates a callback to the proxy
-func (p *Proxy) RegisterCallback(callbackType CallbackType, callback CallbackFunction, args ...interface{}) {
-	if p.getCallbacks(callbackType) == nil {
-		p.setCallbacks(callbackType, make(map[string]*CallbackTuple))
-	}
-	funcName := runtime.FuncForPC(reflect.ValueOf(callback).Pointer()).Name()
-	log.Debugf("value of function: %s", funcName)
-	funcHash := fmt.Sprintf("%x", md5.Sum([]byte(funcName)))[:12]
-
-	p.setCallback(callbackType, funcHash, &CallbackTuple{callback, args})
-}
-
-// UnregisterCallback removes references to a callback within a proxy
-func (p *Proxy) UnregisterCallback(callbackType CallbackType, callback CallbackFunction, args ...interface{}) {
-	if p.getCallbacks(callbackType) == nil {
-		log.Errorf("no such callback type - %s", callbackType.String())
-		return
-	}
-
-	funcName := runtime.FuncForPC(reflect.ValueOf(callback).Pointer()).Name()
-	funcHash := fmt.Sprintf("%x", md5.Sum([]byte(funcName)))[:12]
-
-	log.Debugf("value of function: %s", funcName)
-
-	if p.getCallback(callbackType, funcHash) == nil {
-		log.Errorf("function with hash value: '%s' not registered with callback type: '%s'", funcHash, callbackType)
-		return
-	}
-
-	p.DeleteCallback(callbackType, funcHash)
-}
-
-func (p *Proxy) invoke(callback *CallbackTuple, context []interface{}) (result interface{}, err error) {
-	defer func() {
-		if r := recover(); r != nil {
-			errStr := fmt.Sprintf("callback error occurred: %+v", r)
-			err = errors.New(errStr)
-			log.Error(errStr)
-		}
-	}()
-
-	result = callback.Execute(context)
-
-	return result, err
-}
-
-// InvokeCallbacks executes all callbacks associated to a specific type
-func (p *Proxy) InvokeCallbacks(args ...interface{}) (result interface{}) {
-	callbackType := args[0].(CallbackType)
-	proceedOnError := args[1].(bool)
-	context := args[2:]
-
-	var err error
-
-	if callbacks := p.getCallbacks(callbackType); callbacks != nil {
-		p.mutex.Lock()
-		for _, callback := range callbacks {
-			if result, err = p.invoke(callback, context); err != nil {
-				if !proceedOnError {
-					log.Info("An error occurred.  Stopping callback invocation")
-					break
-				}
-				log.Info("An error occurred.  Invoking next callback")
-			}
-		}
-		p.mutex.Unlock()
-	}
-
-	return result
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/revision.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/revision.go
deleted file mode 100644
index 29fc5e9..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/revision.go
+++ /dev/null
@@ -1,54 +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 model
-
-import (
-	"context"
-	"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
-	"time"
-)
-
-type Revision interface {
-	Finalize(bool)
-	SetConfig(revision *DataRevision)
-	GetConfig() *DataRevision
-	Drop(txid string, includeConfig bool)
-	StorageDrop(txid string, includeConfig bool)
-	ChildDrop(childType string, childHash string)
-	ChildDropByName(childName string)
-	SetChildren(name string, children []Revision)
-	GetChildren(name string) []Revision
-	SetAllChildren(children map[string][]Revision)
-	GetAllChildren() map[string][]Revision
-	SetHash(hash string)
-	GetHash() string
-	ClearHash()
-	getVersion() int64
-	SetupWatch(key string)
-	SetName(name string)
-	GetName() string
-	SetBranch(branch *Branch)
-	GetBranch() *Branch
-	Get(int) interface{}
-	GetData() interface{}
-	GetNode() *node
-	SetLastUpdate(ts ...time.Time)
-	GetLastUpdate() time.Time
-	LoadFromPersistence(ctx context.Context, path string, txid string, blobs map[string]*kvstore.KVPair) []Revision
-	UpdateData(ctx context.Context, data interface{}, branch *Branch) Revision
-	UpdateChildren(ctx context.Context, name string, children []Revision, branch *Branch) Revision
-	UpdateAllChildren(children map[string][]Revision, branch *Branch) Revision
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/root.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/root.go
deleted file mode 100644
index 771f938..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/root.go
+++ /dev/null
@@ -1,310 +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 model
-
-import (
-	"context"
-	"encoding/hex"
-	"encoding/json"
-	"github.com/golang/protobuf/proto"
-	"github.com/google/uuid"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"reflect"
-	"sync"
-)
-
-// Root is used to provide an abstraction to the base root structure
-type Root interface {
-	Node
-
-	ExecuteCallbacks()
-	AddCallback(callback CallbackFunction, args ...interface{})
-	AddNotificationCallback(callback CallbackFunction, args ...interface{})
-}
-
-// root points to the top of the data model tree or sub-tree identified by a proxy
-type root struct {
-	*node
-
-	Callbacks             []CallbackTuple
-	NotificationCallbacks []CallbackTuple
-
-	DirtyNodes    map[string][]*node
-	KvStore       *Backend
-	Loading       bool
-	RevisionClass interface{}
-
-	mutex sync.RWMutex
-}
-
-// NewRoot creates an new instance of a root object
-func NewRoot(initialData interface{}, kvStore *Backend) *root {
-	root := &root{}
-
-	root.KvStore = kvStore
-	root.DirtyNodes = make(map[string][]*node)
-	root.Loading = false
-
-	// If there is no storage in place just revert to
-	// a non persistent mechanism
-	if kvStore != nil {
-		root.RevisionClass = reflect.TypeOf(PersistedRevision{})
-	} else {
-		root.RevisionClass = reflect.TypeOf(NonPersistedRevision{})
-	}
-
-	root.Callbacks = []CallbackTuple{}
-	root.NotificationCallbacks = []CallbackTuple{}
-
-	root.node = NewNode(root, initialData, false, "")
-
-	return root
-}
-
-// MakeTxBranch creates a new transaction branch
-func (r *root) MakeTxBranch() string {
-	txidBin, _ := uuid.New().MarshalBinary()
-	txid := hex.EncodeToString(txidBin)[:12]
-
-	r.DirtyNodes[txid] = []*node{r.node}
-	r.node.MakeBranch(txid)
-
-	return txid
-}
-
-// DeleteTxBranch removes a transaction branch
-func (r *root) DeleteTxBranch(txid string) {
-	for _, dirtyNode := range r.DirtyNodes[txid] {
-		dirtyNode.DeleteBranch(txid)
-	}
-	delete(r.DirtyNodes, txid)
-	r.node.DeleteBranch(txid)
-}
-
-// FoldTxBranch will merge the contents of a transaction branch with the root object
-func (r *root) FoldTxBranch(txid string) {
-	// Start by doing a dry run of the merge
-	// If that fails, it bails out and the branch is deleted
-	if _, err := r.node.MergeBranch(txid, true); err != nil {
-		// Merge operation fails
-		r.DeleteTxBranch(txid)
-	} else {
-		r.node.MergeBranch(txid, false)
-		r.node.GetRoot().ExecuteCallbacks()
-		r.DeleteTxBranch(txid)
-	}
-}
-
-// ExecuteCallbacks will invoke all the callbacks linked to root object
-func (r *root) ExecuteCallbacks() {
-	r.mutex.Lock()
-	defer r.mutex.Unlock()
-
-	for len(r.Callbacks) > 0 {
-		callback := r.Callbacks[0]
-		r.Callbacks = r.Callbacks[1:]
-		go callback.Execute(nil)
-	}
-	//for len(r.NotificationCallbacks) > 0 {
-	//	callback := r.NotificationCallbacks[0]
-	//	r.NotificationCallbacks = r.NotificationCallbacks[1:]
-	//	go callback.Execute(nil)
-	//}
-}
-
-func (r *root) hasCallbacks() bool {
-	return len(r.Callbacks) == 0
-}
-
-// getCallbacks returns the available callbacks
-func (r *root) GetCallbacks() []CallbackTuple {
-	r.mutex.Lock()
-	defer r.mutex.Unlock()
-
-	return r.Callbacks
-}
-
-// getCallbacks returns the available notification callbacks
-func (r *root) GetNotificationCallbacks() []CallbackTuple {
-	r.mutex.Lock()
-	defer r.mutex.Unlock()
-
-	return r.NotificationCallbacks
-}
-
-// AddCallback inserts a new callback with its arguments
-func (r *root) AddCallback(callback CallbackFunction, args ...interface{}) {
-	r.mutex.Lock()
-	defer r.mutex.Unlock()
-
-	r.Callbacks = append(r.Callbacks, CallbackTuple{callback, args})
-}
-
-// AddNotificationCallback inserts a new notification callback with its arguments
-func (r *root) AddNotificationCallback(callback CallbackFunction, args ...interface{}) {
-	r.mutex.Lock()
-	defer r.mutex.Unlock()
-
-	r.NotificationCallbacks = append(r.NotificationCallbacks, CallbackTuple{callback, args})
-}
-
-func (r *root) syncParent(childRev Revision, txid string) {
-	data := proto.Clone(r.GetProxy().ParentNode.Latest().GetData().(proto.Message))
-
-	for fieldName, _ := range ChildrenFields(data) {
-		childDataName, childDataHolder := GetAttributeValue(data, fieldName, 0)
-		if reflect.TypeOf(childRev.GetData()) == reflect.TypeOf(childDataHolder.Interface()) {
-			childDataHolder = reflect.ValueOf(childRev.GetData())
-			reflect.ValueOf(data).Elem().FieldByName(childDataName).Set(childDataHolder)
-		}
-	}
-
-	r.GetProxy().ParentNode.Latest().SetConfig(NewDataRevision(r.GetProxy().ParentNode.GetRoot(), data))
-	r.GetProxy().ParentNode.Latest(txid).Finalize(false)
-}
-
-// Update modifies the content of an object at a given path with the provided data
-func (r *root) Update(ctx context.Context, path string, data interface{}, strict bool, txid string, makeBranch MakeBranchFunction) Revision {
-	var result Revision
-
-	if makeBranch != nil {
-		// TODO: raise error
-	}
-
-	if r.hasCallbacks() {
-		// TODO: raise error
-	}
-
-	if txid != "" {
-		trackDirty := func(node *node) *Branch {
-			r.DirtyNodes[txid] = append(r.DirtyNodes[txid], node)
-			return node.MakeBranch(txid)
-		}
-		result = r.node.Update(ctx, path, data, strict, txid, trackDirty)
-	} else {
-		result = r.node.Update(ctx, path, data, strict, "", nil)
-	}
-
-	if result != nil {
-		if r.GetProxy().FullPath != r.GetProxy().Path {
-			r.syncParent(result, txid)
-		} else {
-			result.Finalize(false)
-		}
-	}
-
-	r.node.GetRoot().ExecuteCallbacks()
-
-	return result
-}
-
-// Add creates a new object at the given path with the provided data
-func (r *root) Add(ctx context.Context, path string, data interface{}, txid string, makeBranch MakeBranchFunction) Revision {
-	var result Revision
-
-	if makeBranch != nil {
-		// TODO: raise error
-	}
-
-	if r.hasCallbacks() {
-		// TODO: raise error
-	}
-
-	if txid != "" {
-		trackDirty := func(node *node) *Branch {
-			r.DirtyNodes[txid] = append(r.DirtyNodes[txid], node)
-			return node.MakeBranch(txid)
-		}
-		result = r.node.Add(ctx, path, data, txid, trackDirty)
-	} else {
-		result = r.node.Add(ctx, path, data, "", nil)
-	}
-
-	if result != nil {
-		result.Finalize(true)
-		r.node.GetRoot().ExecuteCallbacks()
-	}
-	return result
-}
-
-// Remove discards an object at a given path
-func (r *root) Remove(ctx context.Context, path string, txid string, makeBranch MakeBranchFunction) Revision {
-	var result Revision
-
-	if makeBranch != nil {
-		// TODO: raise error
-	}
-
-	if r.hasCallbacks() {
-		// TODO: raise error
-	}
-
-	if txid != "" {
-		trackDirty := func(node *node) *Branch {
-			r.DirtyNodes[txid] = append(r.DirtyNodes[txid], node)
-			return node.MakeBranch(txid)
-		}
-		result = r.node.Remove(ctx, path, txid, trackDirty)
-	} else {
-		result = r.node.Remove(ctx, path, "", nil)
-	}
-
-	r.node.GetRoot().ExecuteCallbacks()
-
-	return result
-}
-
-// MakeLatest updates a branch with the latest node revision
-func (r *root) MakeLatest(branch *Branch, revision Revision, changeAnnouncement []ChangeTuple) {
-	r.makeLatest(branch, revision, changeAnnouncement)
-}
-
-func (r *root) MakeRevision(branch *Branch, data interface{}, children map[string][]Revision) Revision {
-	if r.RevisionClass.(reflect.Type) == reflect.TypeOf(PersistedRevision{}) {
-		return NewPersistedRevision(branch, data, children)
-	}
-
-	return NewNonPersistedRevision(r, branch, data, children)
-}
-
-func (r *root) makeLatest(branch *Branch, revision Revision, changeAnnouncement []ChangeTuple) {
-	r.node.makeLatest(branch, revision, changeAnnouncement)
-
-	if r.KvStore != nil && branch.Txid == "" {
-		tags := make(map[string]string)
-		for k, v := range r.node.Tags {
-			tags[k] = v.GetHash()
-		}
-		data := &rootData{
-			Latest: branch.GetLatest().GetHash(),
-			Tags:   tags,
-		}
-		if blob, err := json.Marshal(data); err != nil {
-			// TODO report error
-		} else {
-			log.Debugf("Changing root to : %s", string(blob))
-			if err := r.KvStore.Put("root", blob); err != nil {
-				log.Errorf("failed to properly put value in kvstore - err: %s", err.Error())
-			}
-		}
-	}
-}
-
-type rootData struct {
-	Latest string            `json:"latest"`
-	Tags   map[string]string `json:"tags"`
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/transaction.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/transaction.go
deleted file mode 100644
index d7a34e7..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/transaction.go
+++ /dev/null
@@ -1,71 +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 model
-
-import (
-	"context"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-)
-
-type Transaction struct {
-	proxy *Proxy
-	txid  string
-}
-
-func NewTransaction(proxy *Proxy, txid string) *Transaction {
-	tx := &Transaction{
-		proxy: proxy,
-		txid:  txid,
-	}
-	return tx
-}
-func (t *Transaction) Get(ctx context.Context, path string, depth int, deep bool) interface{} {
-	if t.txid == "" {
-		log.Errorf("closed transaction")
-		return nil
-	}
-	// TODO: need to review the return values at the different layers!!!!!
-	return t.proxy.Get(ctx, path, depth, deep, t.txid)
-}
-func (t *Transaction) Update(ctx context.Context, path string, data interface{}, strict bool) interface{} {
-	if t.txid == "" {
-		log.Errorf("closed transaction")
-		return nil
-	}
-	return t.proxy.Update(ctx, path, data, strict, t.txid)
-}
-func (t *Transaction) Add(ctx context.Context, path string, data interface{}) interface{} {
-	if t.txid == "" {
-		log.Errorf("closed transaction")
-		return nil
-	}
-	return t.proxy.Add(ctx, path, data, t.txid)
-}
-func (t *Transaction) Remove(ctx context.Context, path string) interface{} {
-	if t.txid == "" {
-		log.Errorf("closed transaction")
-		return nil
-	}
-	return t.proxy.Remove(ctx, path, t.txid)
-}
-func (t *Transaction) Cancel() {
-	t.proxy.cancelTransaction(t.txid)
-	t.txid = ""
-}
-func (t *Transaction) Commit() {
-	t.proxy.commitTransaction(t.txid)
-	t.txid = ""
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/utils.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/utils.go
deleted file mode 100644
index b28e92f..0000000
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/db/model/utils.go
+++ /dev/null
@@ -1,275 +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 model
-
-import (
-	"bytes"
-	"encoding/gob"
-	"reflect"
-	"strings"
-)
-
-// IsProtoMessage determines if the specified implements proto.Message type
-func IsProtoMessage(object interface{}) bool {
-	var ok = false
-
-	if object != nil {
-		st := reflect.TypeOf(object)
-		_, ok = st.MethodByName("ProtoMessage")
-	}
-	return ok
-}
-
-// FindOwnerType will traverse a data structure and find the parent type of the specified object
-func FindOwnerType(obj reflect.Value, name string, depth int, found bool) reflect.Type {
-	prefix := ""
-	for d := 0; d < depth; d++ {
-		prefix += ">>"
-	}
-	k := obj.Kind()
-	switch k {
-	case reflect.Ptr:
-		if found {
-			return obj.Type()
-		}
-
-		t := obj.Type().Elem()
-		n := reflect.New(t)
-
-		if rc := FindOwnerType(n.Elem(), name, depth+1, found); rc != nil {
-			return rc
-		}
-
-	case reflect.Struct:
-		if found {
-			return obj.Type()
-		}
-
-		for i := 0; i < obj.NumField(); i++ {
-			v := reflect.Indirect(obj)
-
-			json := strings.Split(v.Type().Field(i).Tag.Get("json"), ",")
-
-			if json[0] == name {
-				return FindOwnerType(obj.Field(i), name, depth+1, true)
-			}
-
-			if rc := FindOwnerType(obj.Field(i), name, depth+1, found); rc != nil {
-				return rc
-			}
-		}
-	case reflect.Slice:
-		s := reflect.MakeSlice(obj.Type(), 1, 1)
-		n := reflect.New(obj.Type())
-		n.Elem().Set(s)
-
-		for i := 0; i < n.Elem().Len(); i++ {
-			if found {
-				return reflect.ValueOf(n.Elem().Index(i).Interface()).Type()
-			}
-		}
-
-		for i := 0; i < obj.Len(); i++ {
-			if found {
-				return obj.Index(i).Type()
-			}
-
-			if rc := FindOwnerType(obj.Index(i), name, depth+1, found); rc != nil {
-				return rc
-			}
-		}
-	default:
-		//log.Debugf("%s Unhandled <%+v> ... It's a %+v\n", prefix, obj, k)
-	}
-
-	return nil
-}
-
-// FindKeyOwner will traverse a structure to find the owner type of the specified name
-func FindKeyOwner(iface interface{}, name string, depth int) interface{} {
-	obj := reflect.ValueOf(iface)
-	k := obj.Kind()
-	switch k {
-	case reflect.Ptr:
-		t := obj.Type().Elem()
-		n := reflect.New(t)
-
-		if rc := FindKeyOwner(n.Elem().Interface(), name, depth+1); rc != nil {
-			return rc
-		}
-
-	case reflect.Struct:
-		for i := 0; i < obj.NumField(); i++ {
-			json := strings.Split(obj.Type().Field(i).Tag.Get("json"), ",")
-
-			if json[0] == name {
-				return obj.Type().Field(i).Type
-			}
-
-			if rc := FindKeyOwner(obj.Field(i).Interface(), name, depth+1); rc != nil {
-				return rc
-			}
-		}
-
-	case reflect.Slice:
-		s := reflect.MakeSlice(obj.Type(), 1, 1)
-		n := reflect.New(obj.Type())
-		n.Elem().Set(s)
-
-		for i := 0; i < n.Elem().Len(); i++ {
-			if rc := FindKeyOwner(n.Elem().Index(i).Interface(), name, depth+1); rc != nil {
-				return rc
-			}
-		}
-	default:
-		//log.Debugf("%s Unhandled <%+v> ... It's a %+v\n", prefix, obj, k)
-	}
-
-	return nil
-}
-
-// GetAttributeValue traverse a structure to find the value of an attribute
-// FIXME: Need to figure out if GetAttributeValue and GetAttributeStructure can become one
-// Code is repeated in both, but outputs have a different purpose
-// Left as-is for now to get things working
-func GetAttributeValue(data interface{}, name string, depth int) (string, reflect.Value) {
-	var attribName string
-	var attribValue reflect.Value
-	obj := reflect.ValueOf(data)
-
-	if !obj.IsValid() {
-		return attribName, attribValue
-	}
-
-	k := obj.Kind()
-	switch k {
-	case reflect.Ptr:
-		if obj.IsNil() {
-			return attribName, attribValue
-		}
-
-		if attribName, attribValue = GetAttributeValue(obj.Elem().Interface(), name, depth+1); attribValue.IsValid() {
-			return attribName, attribValue
-		}
-
-	case reflect.Struct:
-		for i := 0; i < obj.NumField(); i++ {
-			json := strings.Split(obj.Type().Field(i).Tag.Get("json"), ",")
-
-			if json[0] == name {
-				return obj.Type().Field(i).Name, obj.Field(i)
-			}
-
-			if obj.Field(i).IsValid() {
-				if attribName, attribValue = GetAttributeValue(obj.Field(i).Interface(), name, depth+1); attribValue.IsValid() {
-					return attribName, attribValue
-				}
-			}
-		}
-
-	case reflect.Slice:
-		s := reflect.MakeSlice(obj.Type(), 1, 1)
-		n := reflect.New(obj.Type())
-		n.Elem().Set(s)
-
-		for i := 0; i < obj.Len(); i++ {
-			if attribName, attribValue = GetAttributeValue(obj.Index(i).Interface(), name, depth+1); attribValue.IsValid() {
-				return attribName, attribValue
-			}
-		}
-	default:
-		//log.Debugf("%s Unhandled <%+v> ... It's a %+v\n", prefix, obj, k)
-	}
-
-	return attribName, attribValue
-
-}
-
-// GetAttributeStructure will traverse a structure to find the data structure for the named attribute
-// FIXME: See GetAttributeValue(...) comment
-func GetAttributeStructure(data interface{}, name string, depth int) reflect.StructField {
-	var result reflect.StructField
-	obj := reflect.ValueOf(data)
-
-	if !obj.IsValid() {
-		return result
-	}
-
-	k := obj.Kind()
-	switch k {
-	case reflect.Ptr:
-		t := obj.Type().Elem()
-		n := reflect.New(t)
-
-		if rc := GetAttributeStructure(n.Elem().Interface(), name, depth+1); rc.Name != "" {
-			return rc
-		}
-
-	case reflect.Struct:
-		for i := 0; i < obj.NumField(); i++ {
-			v := reflect.Indirect(obj)
-			json := strings.Split(obj.Type().Field(i).Tag.Get("json"), ",")
-
-			if json[0] == name {
-				return v.Type().Field(i)
-			}
-
-			if obj.Field(i).IsValid() {
-				if rc := GetAttributeStructure(obj.Field(i).Interface(), name, depth+1); rc.Name != "" {
-					return rc
-				}
-			}
-		}
-
-	case reflect.Slice:
-		s := reflect.MakeSlice(obj.Type(), 1, 1)
-		n := reflect.New(obj.Type())
-		n.Elem().Set(s)
-
-		for i := 0; i < obj.Len(); i++ {
-			if rc := GetAttributeStructure(obj.Index(i).Interface(), name, depth+1); rc.Name != "" {
-				return rc
-			}
-
-		}
-	default:
-		//log.Debugf("%s Unhandled <%+v> ... It's a %+v\n", prefix, obj, k)
-	}
-
-	return result
-
-}
-
-func clone2(a interface{}) interface{} {
-	b := reflect.ValueOf(a)
-	buff := new(bytes.Buffer)
-	enc := gob.NewEncoder(buff)
-	dec := gob.NewDecoder(buff)
-	enc.Encode(a)
-	dec.Decode(b.Elem().Interface())
-
-	return b.Interface()
-}
-
-func clone(a, b interface{}) interface{} {
-	buff := new(bytes.Buffer)
-	enc := gob.NewEncoder(buff)
-	dec := gob.NewDecoder(buff)
-	enc.Encode(a)
-	dec.Decode(b)
-	return b
-}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/ponresourcemanager/ponresourcemanager.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/ponresourcemanager/ponresourcemanager.go
index 279dc35..0abe6c1 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/ponresourcemanager/ponresourcemanager.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/ponresourcemanager/ponresourcemanager.go
@@ -23,9 +23,9 @@
 	"fmt"
 	"strconv"
 
-	bitmap "github.com/boljen/go-bitmap"
+	"github.com/boljen/go-bitmap"
+	"github.com/opencord/voltha-lib-go/v2/pkg/db"
 	"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
-	"github.com/opencord/voltha-lib-go/v2/pkg/db/model"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	tp "github.com/opencord/voltha-lib-go/v2/pkg/techprofile"
 )
@@ -128,7 +128,7 @@
 	Host           string // host ip of the KV store
 	Port           int    // port number for the KV store
 	OLTModel       string
-	KVStore        *model.Backend
+	KVStore        *db.Backend
 	TechProfileMgr tp.TechProfileIf // create object of *tp.TechProfileMgr
 
 	// Below attribute, pon_resource_ranges, should be initialized
@@ -151,7 +151,7 @@
 	return nil, errors.New("unsupported-kv-store")
 }
 
-func SetKVClient(Technology string, Backend string, Host string, Port int) *model.Backend {
+func SetKVClient(Technology string, Backend string, Host string, Port int) *db.Backend {
 	addr := Host + ":" + strconv.Itoa(Port)
 	// TODO : Make sure direct call to NewBackend is working fine with backend , currently there is some
 	// issue between kv store and backend , core is not calling NewBackend directly
@@ -160,7 +160,7 @@
 		log.Fatalw("Failed to init KV client\n", log.Fields{"err": err})
 		return nil
 	}
-	kvbackend := &model.Backend{
+	kvbackend := &db.Backend{
 		Client:     kvClient,
 		StoreType:  Backend,
 		Host:       Host,
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/config.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/config.go
index 3a45af1..9c64bd8 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/config.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/config.go
@@ -16,7 +16,7 @@
 package techprofile
 
 import (
-	"github.com/opencord/voltha-lib-go/v2/pkg/db/model"
+	"github.com/opencord/voltha-lib-go/v2/pkg/db"
 )
 
 // tech profile default constants
@@ -83,7 +83,7 @@
 	KVStorePort          int
 	KVStoreType          string
 	KVStoreTimeout       int
-	KVBackend            *model.Backend
+	KVBackend            *db.Backend
 	TPKVPathPrefix       string
 	TPFileKVPath         string
 	TPInstanceKVPath     string
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/tech_profile.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/tech_profile.go
index ea7b36a..92569f0 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/tech_profile.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/tech_profile.go
@@ -22,8 +22,8 @@
 	"fmt"
 	"strconv"
 
+	"github.com/opencord/voltha-lib-go/v2/pkg/db"
 	"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
-	"github.com/opencord/voltha-lib-go/v2/pkg/db/model"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	tp_pb "github.com/opencord/voltha-protos/v2/go/tech_profile"
 )
@@ -226,7 +226,7 @@
 	DownstreamGemPortAttributeList []iGemPortAttribute `json:"downstream_gem_port_attribute_list"`
 }
 
-func (t *TechProfileMgr) SetKVClient() *model.Backend {
+func (t *TechProfileMgr) SetKVClient() *db.Backend {
 	addr := t.config.KVStoreHost + ":" + strconv.Itoa(t.config.KVStorePort)
 	kvClient, err := newKVClient(t.config.KVStoreType, addr, t.config.KVStoreTimeout)
 	if err != nil {
@@ -238,7 +238,7 @@
 			})
 		return nil
 	}
-	return &model.Backend{
+	return &db.Backend{
 		Client:     kvClient,
 		StoreType:  t.config.KVStoreType,
 		Host:       t.config.KVStoreHost,
diff --git a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/tech_profile_if.go b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/tech_profile_if.go
index 0904d7e..3267759 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/tech_profile_if.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v2/pkg/techprofile/tech_profile_if.go
@@ -17,12 +17,12 @@
 package techprofile
 
 import (
-	"github.com/opencord/voltha-lib-go/v2/pkg/db/model"
+	"github.com/opencord/voltha-lib-go/v2/pkg/db"
 	tp_pb "github.com/opencord/voltha-protos/v2/go/tech_profile"
 )
 
 type TechProfileIf interface {
-	SetKVClient() *model.Backend
+	SetKVClient() *db.Backend
 	GetTechProfileInstanceKVPath(techProfiletblID uint32, uniPortName string) string
 	GetTPInstanceFromKVStore(techProfiletblID uint32, path string) (*TechProfile, error)
 	CreateTechProfInstance(techProfiletblID uint32, uniPortName string, intfId uint32) *TechProfile
diff --git a/vendor/golang.org/x/sys/unix/mkasm_darwin.go b/vendor/golang.org/x/sys/unix/mkasm_darwin.go
deleted file mode 100644
index 4548b99..0000000
--- a/vendor/golang.org/x/sys/unix/mkasm_darwin.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go.
-//This program must be run after mksyscall.go.
-package main
-
-import (
-	"bytes"
-	"fmt"
-	"io/ioutil"
-	"log"
-	"os"
-	"strings"
-)
-
-func main() {
-	in1, err := ioutil.ReadFile("syscall_darwin.go")
-	if err != nil {
-		log.Fatalf("can't open syscall_darwin.go: %s", err)
-	}
-	arch := os.Args[1]
-	in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch))
-	if err != nil {
-		log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err)
-	}
-	in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch))
-	if err != nil {
-		log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err)
-	}
-	in := string(in1) + string(in2) + string(in3)
-
-	trampolines := map[string]bool{}
-
-	var out bytes.Buffer
-
-	fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " "))
-	fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n")
-	fmt.Fprintf(&out, "\n")
-	fmt.Fprintf(&out, "// +build go1.12\n")
-	fmt.Fprintf(&out, "\n")
-	fmt.Fprintf(&out, "#include \"textflag.h\"\n")
-	for _, line := range strings.Split(in, "\n") {
-		if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") {
-			continue
-		}
-		fn := line[5 : len(line)-13]
-		if !trampolines[fn] {
-			trampolines[fn] = true
-			fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn)
-			fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
-		}
-	}
-	err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644)
-	if err != nil {
-		log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err)
-	}
-}
diff --git a/vendor/golang.org/x/sys/unix/mkpost.go b/vendor/golang.org/x/sys/unix/mkpost.go
deleted file mode 100644
index eb43320..0000000
--- a/vendor/golang.org/x/sys/unix/mkpost.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-// mkpost processes the output of cgo -godefs to
-// modify the generated types. It is used to clean up
-// the sys API in an architecture specific manner.
-//
-// mkpost is run after cgo -godefs; see README.md.
-package main
-
-import (
-	"bytes"
-	"fmt"
-	"go/format"
-	"io/ioutil"
-	"log"
-	"os"
-	"regexp"
-)
-
-func main() {
-	// Get the OS and architecture (using GOARCH_TARGET if it exists)
-	goos := os.Getenv("GOOS")
-	goarch := os.Getenv("GOARCH_TARGET")
-	if goarch == "" {
-		goarch = os.Getenv("GOARCH")
-	}
-	// Check that we are using the Docker-based build system if we should be.
-	if goos == "linux" {
-		if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
-			os.Stderr.WriteString("In the Docker-based build system, mkpost should not be called directly.\n")
-			os.Stderr.WriteString("See README.md\n")
-			os.Exit(1)
-		}
-	}
-
-	b, err := ioutil.ReadAll(os.Stdin)
-	if err != nil {
-		log.Fatal(err)
-	}
-
-	if goos == "aix" {
-		// Replace type of Atim, Mtim and Ctim by Timespec in Stat_t
-		// to avoid having both StTimespec and Timespec.
-		sttimespec := regexp.MustCompile(`_Ctype_struct_st_timespec`)
-		b = sttimespec.ReplaceAll(b, []byte("Timespec"))
-	}
-
-	// Intentionally export __val fields in Fsid and Sigset_t
-	valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__(bits|val)(\s+\S+\s+)}`)
-	b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$4}"))
-
-	// Intentionally export __fds_bits field in FdSet
-	fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`)
-	b = fdSetRegex.ReplaceAll(b, []byte("type $1 struct {${2}Bits$3}"))
-
-	// If we have empty Ptrace structs, we should delete them. Only s390x emits
-	// nonempty Ptrace structs.
-	ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)
-	b = ptraceRexexp.ReplaceAll(b, nil)
-
-	// Replace the control_regs union with a blank identifier for now.
-	controlRegsRegex := regexp.MustCompile(`(Control_regs)\s+\[0\]uint64`)
-	b = controlRegsRegex.ReplaceAll(b, []byte("_ [0]uint64"))
-
-	// Remove fields that are added by glibc
-	// Note that this is unstable as the identifers are private.
-	removeFieldsRegex := regexp.MustCompile(`X__glibc\S*`)
-	b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
-
-	// Convert [65]int8 to [65]byte in Utsname members to simplify
-	// conversion to string; see golang.org/issue/20753
-	convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`)
-	b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))
-
-	// Convert [1024]int8 to [1024]byte in Ptmget members
-	convertPtmget := regexp.MustCompile(`([SC]n)(\s+)\[(\d+)\]u?int8`)
-	b = convertPtmget.ReplaceAll(b, []byte("$1[$3]byte"))
-
-	// Remove spare fields (e.g. in Statx_t)
-	spareFieldsRegex := regexp.MustCompile(`X__spare\S*`)
-	b = spareFieldsRegex.ReplaceAll(b, []byte("_"))
-
-	// Remove cgo padding fields
-	removePaddingFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`)
-	b = removePaddingFieldsRegex.ReplaceAll(b, []byte("_"))
-
-	// Remove padding, hidden, or unused fields
-	removeFieldsRegex = regexp.MustCompile(`\b(X_\S+|Padding)`)
-	b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
-
-	// Remove the first line of warning from cgo
-	b = b[bytes.IndexByte(b, '\n')+1:]
-	// Modify the command in the header to include:
-	//  mkpost, our own warning, and a build tag.
-	replacement := fmt.Sprintf(`$1 | go run mkpost.go
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build %s,%s`, goarch, goos)
-	cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`)
-	b = cgoCommandRegex.ReplaceAll(b, []byte(replacement))
-
-	// Rename Stat_t time fields
-	if goos == "freebsd" && goarch == "386" {
-		// Hide Stat_t.[AMCB]tim_ext fields
-		renameStatTimeExtFieldsRegex := regexp.MustCompile(`[AMCB]tim_ext`)
-		b = renameStatTimeExtFieldsRegex.ReplaceAll(b, []byte("_"))
-	}
-	renameStatTimeFieldsRegex := regexp.MustCompile(`([AMCB])(?:irth)?time?(?:spec)?\s+(Timespec|StTimespec)`)
-	b = renameStatTimeFieldsRegex.ReplaceAll(b, []byte("${1}tim ${2}"))
-
-	// gofmt
-	b, err = format.Source(b)
-	if err != nil {
-		log.Fatal(err)
-	}
-
-	os.Stdout.Write(b)
-}
diff --git a/vendor/golang.org/x/sys/unix/mksyscall.go b/vendor/golang.org/x/sys/unix/mksyscall.go
deleted file mode 100644
index e4af942..0000000
--- a/vendor/golang.org/x/sys/unix/mksyscall.go
+++ /dev/null
@@ -1,407 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-This program reads a file containing function prototypes
-(like syscall_darwin.go) and generates system call bodies.
-The prototypes are marked by lines beginning with "//sys"
-and read like func declarations if //sys is replaced by func, but:
-	* The parameter lists must give a name for each argument.
-	  This includes return parameters.
-	* The parameter lists must give a type for each argument:
-	  the (x, y, z int) shorthand is not allowed.
-	* If the return parameter is an error number, it must be named errno.
-
-A line beginning with //sysnb is like //sys, except that the
-goroutine will not be suspended during the execution of the system
-call.  This must only be used for system calls which can never
-block, as otherwise the system call could cause all goroutines to
-hang.
-*/
-package main
-
-import (
-	"bufio"
-	"flag"
-	"fmt"
-	"os"
-	"regexp"
-	"strings"
-)
-
-var (
-	b32       = flag.Bool("b32", false, "32bit big-endian")
-	l32       = flag.Bool("l32", false, "32bit little-endian")
-	plan9     = flag.Bool("plan9", false, "plan9")
-	openbsd   = flag.Bool("openbsd", false, "openbsd")
-	netbsd    = flag.Bool("netbsd", false, "netbsd")
-	dragonfly = flag.Bool("dragonfly", false, "dragonfly")
-	arm       = flag.Bool("arm", false, "arm") // 64-bit value should use (even, odd)-pair
-	tags      = flag.String("tags", "", "build tags")
-	filename  = flag.String("output", "", "output file name (standard output if omitted)")
-)
-
-// cmdLine returns this programs's commandline arguments
-func cmdLine() string {
-	return "go run mksyscall.go " + strings.Join(os.Args[1:], " ")
-}
-
-// buildTags returns build tags
-func buildTags() string {
-	return *tags
-}
-
-// Param is function parameter
-type Param struct {
-	Name string
-	Type string
-}
-
-// usage prints the program usage
-func usage() {
-	fmt.Fprintf(os.Stderr, "usage: go run mksyscall.go [-b32 | -l32] [-tags x,y] [file ...]\n")
-	os.Exit(1)
-}
-
-// parseParamList parses parameter list and returns a slice of parameters
-func parseParamList(list string) []string {
-	list = strings.TrimSpace(list)
-	if list == "" {
-		return []string{}
-	}
-	return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
-}
-
-// parseParam splits a parameter into name and type
-func parseParam(p string) Param {
-	ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
-	if ps == nil {
-		fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
-		os.Exit(1)
-	}
-	return Param{ps[1], ps[2]}
-}
-
-func main() {
-	// Get the OS and architecture (using GOARCH_TARGET if it exists)
-	goos := os.Getenv("GOOS")
-	if goos == "" {
-		fmt.Fprintln(os.Stderr, "GOOS not defined in environment")
-		os.Exit(1)
-	}
-	goarch := os.Getenv("GOARCH_TARGET")
-	if goarch == "" {
-		goarch = os.Getenv("GOARCH")
-	}
-
-	// Check that we are using the Docker-based build system if we should
-	if goos == "linux" {
-		if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
-			fmt.Fprintf(os.Stderr, "In the Docker-based build system, mksyscall should not be called directly.\n")
-			fmt.Fprintf(os.Stderr, "See README.md\n")
-			os.Exit(1)
-		}
-	}
-
-	flag.Usage = usage
-	flag.Parse()
-	if len(flag.Args()) <= 0 {
-		fmt.Fprintf(os.Stderr, "no files to parse provided\n")
-		usage()
-	}
-
-	endianness := ""
-	if *b32 {
-		endianness = "big-endian"
-	} else if *l32 {
-		endianness = "little-endian"
-	}
-
-	libc := false
-	if goos == "darwin" && strings.Contains(buildTags(), ",go1.12") {
-		libc = true
-	}
-	trampolines := map[string]bool{}
-
-	text := ""
-	for _, path := range flag.Args() {
-		file, err := os.Open(path)
-		if err != nil {
-			fmt.Fprintf(os.Stderr, err.Error())
-			os.Exit(1)
-		}
-		s := bufio.NewScanner(file)
-		for s.Scan() {
-			t := s.Text()
-			t = strings.TrimSpace(t)
-			t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
-			nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
-			if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
-				continue
-			}
-
-			// Line must be of the form
-			//	func Open(path string, mode int, perm int) (fd int, errno error)
-			// Split into name, in params, out params.
-			f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$`).FindStringSubmatch(t)
-			if f == nil {
-				fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
-				os.Exit(1)
-			}
-			funct, inps, outps, sysname := f[2], f[3], f[4], f[5]
-
-			// ClockGettime doesn't have a syscall number on Darwin, only generate libc wrappers.
-			if goos == "darwin" && !libc && funct == "ClockGettime" {
-				continue
-			}
-
-			// Split argument lists on comma.
-			in := parseParamList(inps)
-			out := parseParamList(outps)
-
-			// Try in vain to keep people from editing this file.
-			// The theory is that they jump into the middle of the file
-			// without reading the header.
-			text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
-
-			// Go function header.
-			outDecl := ""
-			if len(out) > 0 {
-				outDecl = fmt.Sprintf(" (%s)", strings.Join(out, ", "))
-			}
-			text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outDecl)
-
-			// Check if err return available
-			errvar := ""
-			for _, param := range out {
-				p := parseParam(param)
-				if p.Type == "error" {
-					errvar = p.Name
-					break
-				}
-			}
-
-			// Prepare arguments to Syscall.
-			var args []string
-			n := 0
-			for _, param := range in {
-				p := parseParam(param)
-				if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
-					args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))")
-				} else if p.Type == "string" && errvar != "" {
-					text += fmt.Sprintf("\tvar _p%d *byte\n", n)
-					text += fmt.Sprintf("\t_p%d, %s = BytePtrFromString(%s)\n", n, errvar, p.Name)
-					text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
-					args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
-					n++
-				} else if p.Type == "string" {
-					fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
-					text += fmt.Sprintf("\tvar _p%d *byte\n", n)
-					text += fmt.Sprintf("\t_p%d, _ = BytePtrFromString(%s)\n", n, p.Name)
-					args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
-					n++
-				} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
-					// Convert slice into pointer, length.
-					// Have to be careful not to take address of &a[0] if len == 0:
-					// pass dummy pointer in that case.
-					// Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
-					text += fmt.Sprintf("\tvar _p%d unsafe.Pointer\n", n)
-					text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = unsafe.Pointer(&%s[0])\n\t}", p.Name, n, p.Name)
-					text += fmt.Sprintf(" else {\n\t\t_p%d = unsafe.Pointer(&_zero)\n\t}\n", n)
-					args = append(args, fmt.Sprintf("uintptr(_p%d)", n), fmt.Sprintf("uintptr(len(%s))", p.Name))
-					n++
-				} else if p.Type == "int64" && (*openbsd || *netbsd) {
-					args = append(args, "0")
-					if endianness == "big-endian" {
-						args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
-					} else if endianness == "little-endian" {
-						args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
-					} else {
-						args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
-					}
-				} else if p.Type == "int64" && *dragonfly {
-					if regexp.MustCompile(`^(?i)extp(read|write)`).FindStringSubmatch(funct) == nil {
-						args = append(args, "0")
-					}
-					if endianness == "big-endian" {
-						args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
-					} else if endianness == "little-endian" {
-						args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
-					} else {
-						args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
-					}
-				} else if (p.Type == "int64" || p.Type == "uint64") && endianness != "" {
-					if len(args)%2 == 1 && *arm {
-						// arm abi specifies 64-bit argument uses
-						// (even, odd) pair
-						args = append(args, "0")
-					}
-					if endianness == "big-endian" {
-						args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
-					} else {
-						args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
-					}
-				} else {
-					args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
-				}
-			}
-
-			// Determine which form to use; pad args with zeros.
-			asm := "Syscall"
-			if nonblock != nil {
-				if errvar == "" && goos == "linux" {
-					asm = "RawSyscallNoError"
-				} else {
-					asm = "RawSyscall"
-				}
-			} else {
-				if errvar == "" && goos == "linux" {
-					asm = "SyscallNoError"
-				}
-			}
-			if len(args) <= 3 {
-				for len(args) < 3 {
-					args = append(args, "0")
-				}
-			} else if len(args) <= 6 {
-				asm += "6"
-				for len(args) < 6 {
-					args = append(args, "0")
-				}
-			} else if len(args) <= 9 {
-				asm += "9"
-				for len(args) < 9 {
-					args = append(args, "0")
-				}
-			} else {
-				fmt.Fprintf(os.Stderr, "%s:%s too many arguments to system call\n", path, funct)
-			}
-
-			// System call number.
-			if sysname == "" {
-				sysname = "SYS_" + funct
-				sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
-				sysname = strings.ToUpper(sysname)
-			}
-
-			var libcFn string
-			if libc {
-				asm = "syscall_" + strings.ToLower(asm[:1]) + asm[1:] // internal syscall call
-				sysname = strings.TrimPrefix(sysname, "SYS_")         // remove SYS_
-				sysname = strings.ToLower(sysname)                    // lowercase
-				if sysname == "getdirentries64" {
-					// Special case - libSystem name and
-					// raw syscall name don't match.
-					sysname = "__getdirentries64"
-				}
-				libcFn = sysname
-				sysname = "funcPC(libc_" + sysname + "_trampoline)"
-			}
-
-			// Actual call.
-			arglist := strings.Join(args, ", ")
-			call := fmt.Sprintf("%s(%s, %s)", asm, sysname, arglist)
-
-			// Assign return values.
-			body := ""
-			ret := []string{"_", "_", "_"}
-			doErrno := false
-			for i := 0; i < len(out); i++ {
-				p := parseParam(out[i])
-				reg := ""
-				if p.Name == "err" && !*plan9 {
-					reg = "e1"
-					ret[2] = reg
-					doErrno = true
-				} else if p.Name == "err" && *plan9 {
-					ret[0] = "r0"
-					ret[2] = "e1"
-					break
-				} else {
-					reg = fmt.Sprintf("r%d", i)
-					ret[i] = reg
-				}
-				if p.Type == "bool" {
-					reg = fmt.Sprintf("%s != 0", reg)
-				}
-				if p.Type == "int64" && endianness != "" {
-					// 64-bit number in r1:r0 or r0:r1.
-					if i+2 > len(out) {
-						fmt.Fprintf(os.Stderr, "%s:%s not enough registers for int64 return\n", path, funct)
-					}
-					if endianness == "big-endian" {
-						reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1)
-					} else {
-						reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i)
-					}
-					ret[i] = fmt.Sprintf("r%d", i)
-					ret[i+1] = fmt.Sprintf("r%d", i+1)
-				}
-				if reg != "e1" || *plan9 {
-					body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
-				}
-			}
-			if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" {
-				text += fmt.Sprintf("\t%s\n", call)
-			} else {
-				if errvar == "" && goos == "linux" {
-					// raw syscall without error on Linux, see golang.org/issue/22924
-					text += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], call)
-				} else {
-					text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call)
-				}
-			}
-			text += body
-
-			if *plan9 && ret[2] == "e1" {
-				text += "\tif int32(r0) == -1 {\n"
-				text += "\t\terr = e1\n"
-				text += "\t}\n"
-			} else if doErrno {
-				text += "\tif e1 != 0 {\n"
-				text += "\t\terr = errnoErr(e1)\n"
-				text += "\t}\n"
-			}
-			text += "\treturn\n"
-			text += "}\n\n"
-
-			if libc && !trampolines[libcFn] {
-				// some system calls share a trampoline, like read and readlen.
-				trampolines[libcFn] = true
-				// Declare assembly trampoline.
-				text += fmt.Sprintf("func libc_%s_trampoline()\n", libcFn)
-				// Assembly trampoline calls the libc_* function, which this magic
-				// redirects to use the function from libSystem.
-				text += fmt.Sprintf("//go:linkname libc_%s libc_%s\n", libcFn, libcFn)
-				text += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"/usr/lib/libSystem.B.dylib\"\n", libcFn, libcFn)
-				text += "\n"
-			}
-		}
-		if err := s.Err(); err != nil {
-			fmt.Fprintf(os.Stderr, err.Error())
-			os.Exit(1)
-		}
-		file.Close()
-	}
-	fmt.Printf(srcTemplate, cmdLine(), buildTags(), text)
-}
-
-const srcTemplate = `// %s
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build %s
-
-package unix
-
-import (
-	"syscall"
-	"unsafe"
-)
-
-var _ syscall.Errno
-
-%s
-`
diff --git a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go
deleted file mode 100644
index 3be3cdf..0000000
--- a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go
+++ /dev/null
@@ -1,415 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-This program reads a file containing function prototypes
-(like syscall_aix.go) and generates system call bodies.
-The prototypes are marked by lines beginning with "//sys"
-and read like func declarations if //sys is replaced by func, but:
-	* The parameter lists must give a name for each argument.
-	  This includes return parameters.
-	* The parameter lists must give a type for each argument:
-	  the (x, y, z int) shorthand is not allowed.
-	* If the return parameter is an error number, it must be named err.
-	* If go func name needs to be different than its libc name,
-	* or the function is not in libc, name could be specified
-	* at the end, after "=" sign, like
-	  //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
-*/
-package main
-
-import (
-	"bufio"
-	"flag"
-	"fmt"
-	"os"
-	"regexp"
-	"strings"
-)
-
-var (
-	b32  = flag.Bool("b32", false, "32bit big-endian")
-	l32  = flag.Bool("l32", false, "32bit little-endian")
-	aix  = flag.Bool("aix", false, "aix")
-	tags = flag.String("tags", "", "build tags")
-)
-
-// cmdLine returns this programs's commandline arguments
-func cmdLine() string {
-	return "go run mksyscall_aix_ppc.go " + strings.Join(os.Args[1:], " ")
-}
-
-// buildTags returns build tags
-func buildTags() string {
-	return *tags
-}
-
-// Param is function parameter
-type Param struct {
-	Name string
-	Type string
-}
-
-// usage prints the program usage
-func usage() {
-	fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc.go [-b32 | -l32] [-tags x,y] [file ...]\n")
-	os.Exit(1)
-}
-
-// parseParamList parses parameter list and returns a slice of parameters
-func parseParamList(list string) []string {
-	list = strings.TrimSpace(list)
-	if list == "" {
-		return []string{}
-	}
-	return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
-}
-
-// parseParam splits a parameter into name and type
-func parseParam(p string) Param {
-	ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
-	if ps == nil {
-		fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
-		os.Exit(1)
-	}
-	return Param{ps[1], ps[2]}
-}
-
-func main() {
-	flag.Usage = usage
-	flag.Parse()
-	if len(flag.Args()) <= 0 {
-		fmt.Fprintf(os.Stderr, "no files to parse provided\n")
-		usage()
-	}
-
-	endianness := ""
-	if *b32 {
-		endianness = "big-endian"
-	} else if *l32 {
-		endianness = "little-endian"
-	}
-
-	pack := ""
-	text := ""
-	cExtern := "/*\n#include <stdint.h>\n#include <stddef.h>\n"
-	for _, path := range flag.Args() {
-		file, err := os.Open(path)
-		if err != nil {
-			fmt.Fprintf(os.Stderr, err.Error())
-			os.Exit(1)
-		}
-		s := bufio.NewScanner(file)
-		for s.Scan() {
-			t := s.Text()
-			t = strings.TrimSpace(t)
-			t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
-			if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
-				pack = p[1]
-			}
-			nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
-			if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
-				continue
-			}
-
-			// Line must be of the form
-			//	func Open(path string, mode int, perm int) (fd int, err error)
-			// Split into name, in params, out params.
-			f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
-			if f == nil {
-				fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
-				os.Exit(1)
-			}
-			funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
-
-			// Split argument lists on comma.
-			in := parseParamList(inps)
-			out := parseParamList(outps)
-
-			inps = strings.Join(in, ", ")
-			outps = strings.Join(out, ", ")
-
-			// Try in vain to keep people from editing this file.
-			// The theory is that they jump into the middle of the file
-			// without reading the header.
-			text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
-
-			// Check if value return, err return available
-			errvar := ""
-			retvar := ""
-			rettype := ""
-			for _, param := range out {
-				p := parseParam(param)
-				if p.Type == "error" {
-					errvar = p.Name
-				} else {
-					retvar = p.Name
-					rettype = p.Type
-				}
-			}
-
-			// System call name.
-			if sysname == "" {
-				sysname = funct
-			}
-			sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
-			sysname = strings.ToLower(sysname) // All libc functions are lowercase.
-
-			cRettype := ""
-			if rettype == "unsafe.Pointer" {
-				cRettype = "uintptr_t"
-			} else if rettype == "uintptr" {
-				cRettype = "uintptr_t"
-			} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
-				cRettype = "uintptr_t"
-			} else if rettype == "int" {
-				cRettype = "int"
-			} else if rettype == "int32" {
-				cRettype = "int"
-			} else if rettype == "int64" {
-				cRettype = "long long"
-			} else if rettype == "uint32" {
-				cRettype = "unsigned int"
-			} else if rettype == "uint64" {
-				cRettype = "unsigned long long"
-			} else {
-				cRettype = "int"
-			}
-			if sysname == "exit" {
-				cRettype = "void"
-			}
-
-			// Change p.Types to c
-			var cIn []string
-			for _, param := range in {
-				p := parseParam(param)
-				if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
-					cIn = append(cIn, "uintptr_t")
-				} else if p.Type == "string" {
-					cIn = append(cIn, "uintptr_t")
-				} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
-					cIn = append(cIn, "uintptr_t", "size_t")
-				} else if p.Type == "unsafe.Pointer" {
-					cIn = append(cIn, "uintptr_t")
-				} else if p.Type == "uintptr" {
-					cIn = append(cIn, "uintptr_t")
-				} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
-					cIn = append(cIn, "uintptr_t")
-				} else if p.Type == "int" {
-					cIn = append(cIn, "int")
-				} else if p.Type == "int32" {
-					cIn = append(cIn, "int")
-				} else if p.Type == "int64" {
-					cIn = append(cIn, "long long")
-				} else if p.Type == "uint32" {
-					cIn = append(cIn, "unsigned int")
-				} else if p.Type == "uint64" {
-					cIn = append(cIn, "unsigned long long")
-				} else {
-					cIn = append(cIn, "int")
-				}
-			}
-
-			if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" {
-				if sysname == "select" {
-					// select is a keyword of Go. Its name is
-					// changed to c_select.
-					cExtern += "#define c_select select\n"
-				}
-				// Imports of system calls from libc
-				cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
-				cIn := strings.Join(cIn, ", ")
-				cExtern += fmt.Sprintf("(%s);\n", cIn)
-			}
-
-			// So file name.
-			if *aix {
-				if modname == "" {
-					modname = "libc.a/shr_64.o"
-				} else {
-					fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
-					os.Exit(1)
-				}
-			}
-
-			strconvfunc := "C.CString"
-
-			// Go function header.
-			if outps != "" {
-				outps = fmt.Sprintf(" (%s)", outps)
-			}
-			if text != "" {
-				text += "\n"
-			}
-
-			text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
-
-			// Prepare arguments to Syscall.
-			var args []string
-			n := 0
-			argN := 0
-			for _, param := range in {
-				p := parseParam(param)
-				if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
-					args = append(args, "C.uintptr_t(uintptr(unsafe.Pointer("+p.Name+")))")
-				} else if p.Type == "string" && errvar != "" {
-					text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
-					args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
-					n++
-				} else if p.Type == "string" {
-					fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
-					text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
-					args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
-					n++
-				} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
-					// Convert slice into pointer, length.
-					// Have to be careful not to take address of &a[0] if len == 0:
-					// pass nil in that case.
-					text += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
-					text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
-					args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(unsafe.Pointer(_p%d)))", n))
-					n++
-					text += fmt.Sprintf("\tvar _p%d int\n", n)
-					text += fmt.Sprintf("\t_p%d = len(%s)\n", n, p.Name)
-					args = append(args, fmt.Sprintf("C.size_t(_p%d)", n))
-					n++
-				} else if p.Type == "int64" && endianness != "" {
-					if endianness == "big-endian" {
-						args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
-					} else {
-						args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
-					}
-					n++
-				} else if p.Type == "bool" {
-					text += fmt.Sprintf("\tvar _p%d uint32\n", n)
-					text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n)
-					args = append(args, fmt.Sprintf("_p%d", n))
-				} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
-					args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
-				} else if p.Type == "unsafe.Pointer" {
-					args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
-				} else if p.Type == "int" {
-					if (argN == 2) && ((funct == "readlen") || (funct == "writelen")) {
-						args = append(args, fmt.Sprintf("C.size_t(%s)", p.Name))
-					} else if argN == 0 && funct == "fcntl" {
-						args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
-					} else if (argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt")) {
-						args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
-					} else {
-						args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
-					}
-				} else if p.Type == "int32" {
-					args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
-				} else if p.Type == "int64" {
-					args = append(args, fmt.Sprintf("C.longlong(%s)", p.Name))
-				} else if p.Type == "uint32" {
-					args = append(args, fmt.Sprintf("C.uint(%s)", p.Name))
-				} else if p.Type == "uint64" {
-					args = append(args, fmt.Sprintf("C.ulonglong(%s)", p.Name))
-				} else if p.Type == "uintptr" {
-					args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
-				} else {
-					args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
-				}
-				argN++
-			}
-
-			// Actual call.
-			arglist := strings.Join(args, ", ")
-			call := ""
-			if sysname == "exit" {
-				if errvar != "" {
-					call += "er :="
-				} else {
-					call += ""
-				}
-			} else if errvar != "" {
-				call += "r0,er :="
-			} else if retvar != "" {
-				call += "r0,_ :="
-			} else {
-				call += ""
-			}
-			if sysname == "select" {
-				// select is a keyword of Go. Its name is
-				// changed to c_select.
-				call += fmt.Sprintf("C.c_%s(%s)", sysname, arglist)
-			} else {
-				call += fmt.Sprintf("C.%s(%s)", sysname, arglist)
-			}
-
-			// Assign return values.
-			body := ""
-			for i := 0; i < len(out); i++ {
-				p := parseParam(out[i])
-				reg := ""
-				if p.Name == "err" {
-					reg = "e1"
-				} else {
-					reg = "r0"
-				}
-				if reg != "e1" {
-					body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
-				}
-			}
-
-			// verify return
-			if sysname != "exit" && errvar != "" {
-				if regexp.MustCompile(`^uintptr`).FindStringSubmatch(cRettype) != nil {
-					body += "\tif (uintptr(r0) ==^uintptr(0) && er != nil) {\n"
-					body += fmt.Sprintf("\t\t%s = er\n", errvar)
-					body += "\t}\n"
-				} else {
-					body += "\tif (r0 ==-1 && er != nil) {\n"
-					body += fmt.Sprintf("\t\t%s = er\n", errvar)
-					body += "\t}\n"
-				}
-			} else if errvar != "" {
-				body += "\tif (er != nil) {\n"
-				body += fmt.Sprintf("\t\t%s = er\n", errvar)
-				body += "\t}\n"
-			}
-
-			text += fmt.Sprintf("\t%s\n", call)
-			text += body
-
-			text += "\treturn\n"
-			text += "}\n"
-		}
-		if err := s.Err(); err != nil {
-			fmt.Fprintf(os.Stderr, err.Error())
-			os.Exit(1)
-		}
-		file.Close()
-	}
-	imp := ""
-	if pack != "unix" {
-		imp = "import \"golang.org/x/sys/unix\"\n"
-
-	}
-	fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, cExtern, imp, text)
-}
-
-const srcTemplate = `// %s
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build %s
-
-package %s
-
-
-%s
-*/
-import "C"
-import (
-	"unsafe"
-)
-
-
-%s
-
-%s
-`
diff --git a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go
deleted file mode 100644
index c960099..0000000
--- a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go
+++ /dev/null
@@ -1,614 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-This program reads a file containing function prototypes
-(like syscall_aix.go) and generates system call bodies.
-The prototypes are marked by lines beginning with "//sys"
-and read like func declarations if //sys is replaced by func, but:
-	* The parameter lists must give a name for each argument.
-	  This includes return parameters.
-	* The parameter lists must give a type for each argument:
-	  the (x, y, z int) shorthand is not allowed.
-	* If the return parameter is an error number, it must be named err.
-	* If go func name needs to be different than its libc name,
-	* or the function is not in libc, name could be specified
-	* at the end, after "=" sign, like
-	  //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
-
-
-This program will generate three files and handle both gc and gccgo implementation:
-  - zsyscall_aix_ppc64.go: the common part of each implementation (error handler, pointer creation)
-  - zsyscall_aix_ppc64_gc.go: gc part with //go_cgo_import_dynamic and a call to syscall6
-  - zsyscall_aix_ppc64_gccgo.go: gccgo part with C function and conversion to C type.
-
- The generated code looks like this
-
-zsyscall_aix_ppc64.go
-func asyscall(...) (n int, err error) {
-	 // Pointer Creation
-	 r1, e1 := callasyscall(...)
-	 // Type Conversion
-	 // Error Handler
-	 return
-}
-
-zsyscall_aix_ppc64_gc.go
-//go:cgo_import_dynamic libc_asyscall asyscall "libc.a/shr_64.o"
-//go:linkname libc_asyscall libc_asyscall
-var asyscall syscallFunc
-
-func callasyscall(...) (r1 uintptr, e1 Errno) {
-	 r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_asyscall)), "nb_args", ... )
-	 return
-}
-
-zsyscall_aix_ppc64_ggcgo.go
-
-// int asyscall(...)
-
-import "C"
-
-func callasyscall(...) (r1 uintptr, e1 Errno) {
-	 r1 = uintptr(C.asyscall(...))
-	 e1 = syscall.GetErrno()
-	 return
-}
-*/
-
-package main
-
-import (
-	"bufio"
-	"flag"
-	"fmt"
-	"io/ioutil"
-	"os"
-	"regexp"
-	"strings"
-)
-
-var (
-	b32  = flag.Bool("b32", false, "32bit big-endian")
-	l32  = flag.Bool("l32", false, "32bit little-endian")
-	aix  = flag.Bool("aix", false, "aix")
-	tags = flag.String("tags", "", "build tags")
-)
-
-// cmdLine returns this programs's commandline arguments
-func cmdLine() string {
-	return "go run mksyscall_aix_ppc64.go " + strings.Join(os.Args[1:], " ")
-}
-
-// buildTags returns build tags
-func buildTags() string {
-	return *tags
-}
-
-// Param is function parameter
-type Param struct {
-	Name string
-	Type string
-}
-
-// usage prints the program usage
-func usage() {
-	fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc64.go [-b32 | -l32] [-tags x,y] [file ...]\n")
-	os.Exit(1)
-}
-
-// parseParamList parses parameter list and returns a slice of parameters
-func parseParamList(list string) []string {
-	list = strings.TrimSpace(list)
-	if list == "" {
-		return []string{}
-	}
-	return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
-}
-
-// parseParam splits a parameter into name and type
-func parseParam(p string) Param {
-	ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
-	if ps == nil {
-		fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
-		os.Exit(1)
-	}
-	return Param{ps[1], ps[2]}
-}
-
-func main() {
-	flag.Usage = usage
-	flag.Parse()
-	if len(flag.Args()) <= 0 {
-		fmt.Fprintf(os.Stderr, "no files to parse provided\n")
-		usage()
-	}
-
-	endianness := ""
-	if *b32 {
-		endianness = "big-endian"
-	} else if *l32 {
-		endianness = "little-endian"
-	}
-
-	pack := ""
-	// GCCGO
-	textgccgo := ""
-	cExtern := "/*\n#include <stdint.h>\n"
-	// GC
-	textgc := ""
-	dynimports := ""
-	linknames := ""
-	var vars []string
-	// COMMON
-	textcommon := ""
-	for _, path := range flag.Args() {
-		file, err := os.Open(path)
-		if err != nil {
-			fmt.Fprintf(os.Stderr, err.Error())
-			os.Exit(1)
-		}
-		s := bufio.NewScanner(file)
-		for s.Scan() {
-			t := s.Text()
-			t = strings.TrimSpace(t)
-			t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
-			if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
-				pack = p[1]
-			}
-			nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
-			if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
-				continue
-			}
-
-			// Line must be of the form
-			//	func Open(path string, mode int, perm int) (fd int, err error)
-			// Split into name, in params, out params.
-			f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
-			if f == nil {
-				fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
-				os.Exit(1)
-			}
-			funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
-
-			// Split argument lists on comma.
-			in := parseParamList(inps)
-			out := parseParamList(outps)
-
-			inps = strings.Join(in, ", ")
-			outps = strings.Join(out, ", ")
-
-			if sysname == "" {
-				sysname = funct
-			}
-
-			onlyCommon := false
-			if funct == "readlen" || funct == "writelen" || funct == "FcntlInt" || funct == "FcntlFlock" {
-				// This function call another syscall which is already implemented.
-				// Therefore, the gc and gccgo part must not be generated.
-				onlyCommon = true
-			}
-
-			// Try in vain to keep people from editing this file.
-			// The theory is that they jump into the middle of the file
-			// without reading the header.
-
-			textcommon += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
-			if !onlyCommon {
-				textgccgo += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
-				textgc += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
-			}
-
-			// Check if value return, err return available
-			errvar := ""
-			rettype := ""
-			for _, param := range out {
-				p := parseParam(param)
-				if p.Type == "error" {
-					errvar = p.Name
-				} else {
-					rettype = p.Type
-				}
-			}
-
-			sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
-			sysname = strings.ToLower(sysname) // All libc functions are lowercase.
-
-			// GCCGO Prototype return type
-			cRettype := ""
-			if rettype == "unsafe.Pointer" {
-				cRettype = "uintptr_t"
-			} else if rettype == "uintptr" {
-				cRettype = "uintptr_t"
-			} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
-				cRettype = "uintptr_t"
-			} else if rettype == "int" {
-				cRettype = "int"
-			} else if rettype == "int32" {
-				cRettype = "int"
-			} else if rettype == "int64" {
-				cRettype = "long long"
-			} else if rettype == "uint32" {
-				cRettype = "unsigned int"
-			} else if rettype == "uint64" {
-				cRettype = "unsigned long long"
-			} else {
-				cRettype = "int"
-			}
-			if sysname == "exit" {
-				cRettype = "void"
-			}
-
-			// GCCGO Prototype arguments type
-			var cIn []string
-			for i, param := range in {
-				p := parseParam(param)
-				if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
-					cIn = append(cIn, "uintptr_t")
-				} else if p.Type == "string" {
-					cIn = append(cIn, "uintptr_t")
-				} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
-					cIn = append(cIn, "uintptr_t", "size_t")
-				} else if p.Type == "unsafe.Pointer" {
-					cIn = append(cIn, "uintptr_t")
-				} else if p.Type == "uintptr" {
-					cIn = append(cIn, "uintptr_t")
-				} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
-					cIn = append(cIn, "uintptr_t")
-				} else if p.Type == "int" {
-					if (i == 0 || i == 2) && funct == "fcntl" {
-						// These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock
-						cIn = append(cIn, "uintptr_t")
-					} else {
-						cIn = append(cIn, "int")
-					}
-
-				} else if p.Type == "int32" {
-					cIn = append(cIn, "int")
-				} else if p.Type == "int64" {
-					cIn = append(cIn, "long long")
-				} else if p.Type == "uint32" {
-					cIn = append(cIn, "unsigned int")
-				} else if p.Type == "uint64" {
-					cIn = append(cIn, "unsigned long long")
-				} else {
-					cIn = append(cIn, "int")
-				}
-			}
-
-			if !onlyCommon {
-				// GCCGO Prototype Generation
-				// Imports of system calls from libc
-				if sysname == "select" {
-					// select is a keyword of Go. Its name is
-					// changed to c_select.
-					cExtern += "#define c_select select\n"
-				}
-				cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
-				cIn := strings.Join(cIn, ", ")
-				cExtern += fmt.Sprintf("(%s);\n", cIn)
-			}
-			// GC Library name
-			if modname == "" {
-				modname = "libc.a/shr_64.o"
-			} else {
-				fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
-				os.Exit(1)
-			}
-			sysvarname := fmt.Sprintf("libc_%s", sysname)
-
-			if !onlyCommon {
-				// GC Runtime import of function to allow cross-platform builds.
-				dynimports += fmt.Sprintf("//go:cgo_import_dynamic %s %s \"%s\"\n", sysvarname, sysname, modname)
-				// GC Link symbol to proc address variable.
-				linknames += fmt.Sprintf("//go:linkname %s %s\n", sysvarname, sysvarname)
-				// GC Library proc address variable.
-				vars = append(vars, sysvarname)
-			}
-
-			strconvfunc := "BytePtrFromString"
-			strconvtype := "*byte"
-
-			// Go function header.
-			if outps != "" {
-				outps = fmt.Sprintf(" (%s)", outps)
-			}
-			if textcommon != "" {
-				textcommon += "\n"
-			}
-
-			textcommon += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
-
-			// Prepare arguments tocall.
-			var argscommon []string // Arguments in the common part
-			var argscall []string   // Arguments for call prototype
-			var argsgc []string     // Arguments for gc call (with syscall6)
-			var argsgccgo []string  // Arguments for gccgo call (with C.name_of_syscall)
-			n := 0
-			argN := 0
-			for _, param := range in {
-				p := parseParam(param)
-				if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
-					argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(%s))", p.Name))
-					argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
-					argsgc = append(argsgc, p.Name)
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
-				} else if p.Type == "string" && errvar != "" {
-					textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
-					textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
-					textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
-
-					argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
-					argscall = append(argscall, fmt.Sprintf("_p%d uintptr ", n))
-					argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
-					n++
-				} else if p.Type == "string" {
-					fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
-					textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
-					textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
-					textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
-
-					argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
-					argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n))
-					argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
-					n++
-				} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
-					// Convert slice into pointer, length.
-					// Have to be careful not to take address of &a[0] if len == 0:
-					// pass nil in that case.
-					textcommon += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
-					textcommon += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
-					argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("len(%s)", p.Name))
-					argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n), fmt.Sprintf("_lenp%d int", n))
-					argsgc = append(argsgc, fmt.Sprintf("_p%d", n), fmt.Sprintf("uintptr(_lenp%d)", n))
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n), fmt.Sprintf("C.size_t(_lenp%d)", n))
-					n++
-				} else if p.Type == "int64" && endianness != "" {
-					fmt.Fprintf(os.Stderr, path+":"+funct+" uses int64 with 32 bits mode. Case not yet implemented\n")
-				} else if p.Type == "bool" {
-					fmt.Fprintf(os.Stderr, path+":"+funct+" uses bool. Case not yet implemented\n")
-				} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil || p.Type == "unsafe.Pointer" {
-					argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
-					argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
-					argsgc = append(argsgc, p.Name)
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
-				} else if p.Type == "int" {
-					if (argN == 0 || argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt") || (funct == "FcntlFlock")) {
-						// These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock
-						argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
-						argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
-						argsgc = append(argsgc, p.Name)
-						argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
-
-					} else {
-						argscommon = append(argscommon, p.Name)
-						argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
-						argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
-						argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
-					}
-				} else if p.Type == "int32" {
-					argscommon = append(argscommon, p.Name)
-					argscall = append(argscall, fmt.Sprintf("%s int32", p.Name))
-					argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
-				} else if p.Type == "int64" {
-					argscommon = append(argscommon, p.Name)
-					argscall = append(argscall, fmt.Sprintf("%s int64", p.Name))
-					argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.longlong(%s)", p.Name))
-				} else if p.Type == "uint32" {
-					argscommon = append(argscommon, p.Name)
-					argscall = append(argscall, fmt.Sprintf("%s uint32", p.Name))
-					argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.uint(%s)", p.Name))
-				} else if p.Type == "uint64" {
-					argscommon = append(argscommon, p.Name)
-					argscall = append(argscall, fmt.Sprintf("%s uint64", p.Name))
-					argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.ulonglong(%s)", p.Name))
-				} else if p.Type == "uintptr" {
-					argscommon = append(argscommon, p.Name)
-					argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
-					argsgc = append(argsgc, p.Name)
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
-				} else {
-					argscommon = append(argscommon, fmt.Sprintf("int(%s)", p.Name))
-					argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
-					argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
-					argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
-				}
-				argN++
-			}
-			nargs := len(argsgc)
-
-			// COMMON function generation
-			argscommonlist := strings.Join(argscommon, ", ")
-			callcommon := fmt.Sprintf("call%s(%s)", sysname, argscommonlist)
-			ret := []string{"_", "_"}
-			body := ""
-			doErrno := false
-			for i := 0; i < len(out); i++ {
-				p := parseParam(out[i])
-				reg := ""
-				if p.Name == "err" {
-					reg = "e1"
-					ret[1] = reg
-					doErrno = true
-				} else {
-					reg = "r0"
-					ret[0] = reg
-				}
-				if p.Type == "bool" {
-					reg = fmt.Sprintf("%s != 0", reg)
-				}
-				if reg != "e1" {
-					body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
-				}
-			}
-			if ret[0] == "_" && ret[1] == "_" {
-				textcommon += fmt.Sprintf("\t%s\n", callcommon)
-			} else {
-				textcommon += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], callcommon)
-			}
-			textcommon += body
-
-			if doErrno {
-				textcommon += "\tif e1 != 0 {\n"
-				textcommon += "\t\terr = errnoErr(e1)\n"
-				textcommon += "\t}\n"
-			}
-			textcommon += "\treturn\n"
-			textcommon += "}\n"
-
-			if onlyCommon {
-				continue
-			}
-
-			// CALL Prototype
-			callProto := fmt.Sprintf("func call%s(%s) (r1 uintptr, e1 Errno) {\n", sysname, strings.Join(argscall, ", "))
-
-			// GC function generation
-			asm := "syscall6"
-			if nonblock != nil {
-				asm = "rawSyscall6"
-			}
-
-			if len(argsgc) <= 6 {
-				for len(argsgc) < 6 {
-					argsgc = append(argsgc, "0")
-				}
-			} else {
-				fmt.Fprintf(os.Stderr, "%s: too many arguments to system call", funct)
-				os.Exit(1)
-			}
-			argsgclist := strings.Join(argsgc, ", ")
-			callgc := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, argsgclist)
-
-			textgc += callProto
-			textgc += fmt.Sprintf("\tr1, _, e1 = %s\n", callgc)
-			textgc += "\treturn\n}\n"
-
-			// GCCGO function generation
-			argsgccgolist := strings.Join(argsgccgo, ", ")
-			var callgccgo string
-			if sysname == "select" {
-				// select is a keyword of Go. Its name is
-				// changed to c_select.
-				callgccgo = fmt.Sprintf("C.c_%s(%s)", sysname, argsgccgolist)
-			} else {
-				callgccgo = fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist)
-			}
-			textgccgo += callProto
-			textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo)
-			textgccgo += "\te1 = syscall.GetErrno()\n"
-			textgccgo += "\treturn\n}\n"
-		}
-		if err := s.Err(); err != nil {
-			fmt.Fprintf(os.Stderr, err.Error())
-			os.Exit(1)
-		}
-		file.Close()
-	}
-	imp := ""
-	if pack != "unix" {
-		imp = "import \"golang.org/x/sys/unix\"\n"
-
-	}
-
-	// Print zsyscall_aix_ppc64.go
-	err := ioutil.WriteFile("zsyscall_aix_ppc64.go",
-		[]byte(fmt.Sprintf(srcTemplate1, cmdLine(), buildTags(), pack, imp, textcommon)),
-		0644)
-	if err != nil {
-		fmt.Fprintf(os.Stderr, err.Error())
-		os.Exit(1)
-	}
-
-	// Print zsyscall_aix_ppc64_gc.go
-	vardecls := "\t" + strings.Join(vars, ",\n\t")
-	vardecls += " syscallFunc"
-	err = ioutil.WriteFile("zsyscall_aix_ppc64_gc.go",
-		[]byte(fmt.Sprintf(srcTemplate2, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, textgc)),
-		0644)
-	if err != nil {
-		fmt.Fprintf(os.Stderr, err.Error())
-		os.Exit(1)
-	}
-
-	// Print zsyscall_aix_ppc64_gccgo.go
-	err = ioutil.WriteFile("zsyscall_aix_ppc64_gccgo.go",
-		[]byte(fmt.Sprintf(srcTemplate3, cmdLine(), buildTags(), pack, cExtern, imp, textgccgo)),
-		0644)
-	if err != nil {
-		fmt.Fprintf(os.Stderr, err.Error())
-		os.Exit(1)
-	}
-}
-
-const srcTemplate1 = `// %s
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build %s
-
-package %s
-
-import (
-	"unsafe"
-)
-
-
-%s
-
-%s
-`
-const srcTemplate2 = `// %s
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build %s
-// +build !gccgo
-
-package %s
-
-import (
-	"unsafe"
-)
-%s
-%s
-%s
-type syscallFunc uintptr
-
-var (
-%s
-)
-
-// Implemented in runtime/syscall_aix.go.
-func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
-func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
-
-%s
-`
-const srcTemplate3 = `// %s
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build %s
-// +build gccgo
-
-package %s
-
-%s
-*/
-import "C"
-import (
-	"syscall"
-)
-
-
-%s
-
-%s
-`
diff --git a/vendor/golang.org/x/sys/unix/mksyscall_solaris.go b/vendor/golang.org/x/sys/unix/mksyscall_solaris.go
deleted file mode 100644
index 3d86473..0000000
--- a/vendor/golang.org/x/sys/unix/mksyscall_solaris.go
+++ /dev/null
@@ -1,335 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
- This program reads a file containing function prototypes
- (like syscall_solaris.go) and generates system call bodies.
- The prototypes are marked by lines beginning with "//sys"
- and read like func declarations if //sys is replaced by func, but:
-	* The parameter lists must give a name for each argument.
-	  This includes return parameters.
-	* The parameter lists must give a type for each argument:
-	  the (x, y, z int) shorthand is not allowed.
-	* If the return parameter is an error number, it must be named err.
-	* If go func name needs to be different than its libc name,
-	* or the function is not in libc, name could be specified
-	* at the end, after "=" sign, like
-	  //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
-*/
-
-package main
-
-import (
-	"bufio"
-	"flag"
-	"fmt"
-	"os"
-	"regexp"
-	"strings"
-)
-
-var (
-	b32  = flag.Bool("b32", false, "32bit big-endian")
-	l32  = flag.Bool("l32", false, "32bit little-endian")
-	tags = flag.String("tags", "", "build tags")
-)
-
-// cmdLine returns this programs's commandline arguments
-func cmdLine() string {
-	return "go run mksyscall_solaris.go " + strings.Join(os.Args[1:], " ")
-}
-
-// buildTags returns build tags
-func buildTags() string {
-	return *tags
-}
-
-// Param is function parameter
-type Param struct {
-	Name string
-	Type string
-}
-
-// usage prints the program usage
-func usage() {
-	fmt.Fprintf(os.Stderr, "usage: go run mksyscall_solaris.go [-b32 | -l32] [-tags x,y] [file ...]\n")
-	os.Exit(1)
-}
-
-// parseParamList parses parameter list and returns a slice of parameters
-func parseParamList(list string) []string {
-	list = strings.TrimSpace(list)
-	if list == "" {
-		return []string{}
-	}
-	return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
-}
-
-// parseParam splits a parameter into name and type
-func parseParam(p string) Param {
-	ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
-	if ps == nil {
-		fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
-		os.Exit(1)
-	}
-	return Param{ps[1], ps[2]}
-}
-
-func main() {
-	flag.Usage = usage
-	flag.Parse()
-	if len(flag.Args()) <= 0 {
-		fmt.Fprintf(os.Stderr, "no files to parse provided\n")
-		usage()
-	}
-
-	endianness := ""
-	if *b32 {
-		endianness = "big-endian"
-	} else if *l32 {
-		endianness = "little-endian"
-	}
-
-	pack := ""
-	text := ""
-	dynimports := ""
-	linknames := ""
-	var vars []string
-	for _, path := range flag.Args() {
-		file, err := os.Open(path)
-		if err != nil {
-			fmt.Fprintf(os.Stderr, err.Error())
-			os.Exit(1)
-		}
-		s := bufio.NewScanner(file)
-		for s.Scan() {
-			t := s.Text()
-			t = strings.TrimSpace(t)
-			t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
-			if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
-				pack = p[1]
-			}
-			nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
-			if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
-				continue
-			}
-
-			// Line must be of the form
-			//	func Open(path string, mode int, perm int) (fd int, err error)
-			// Split into name, in params, out params.
-			f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
-			if f == nil {
-				fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
-				os.Exit(1)
-			}
-			funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
-
-			// Split argument lists on comma.
-			in := parseParamList(inps)
-			out := parseParamList(outps)
-
-			inps = strings.Join(in, ", ")
-			outps = strings.Join(out, ", ")
-
-			// Try in vain to keep people from editing this file.
-			// The theory is that they jump into the middle of the file
-			// without reading the header.
-			text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
-
-			// So file name.
-			if modname == "" {
-				modname = "libc"
-			}
-
-			// System call name.
-			if sysname == "" {
-				sysname = funct
-			}
-
-			// System call pointer variable name.
-			sysvarname := fmt.Sprintf("proc%s", sysname)
-
-			strconvfunc := "BytePtrFromString"
-			strconvtype := "*byte"
-
-			sysname = strings.ToLower(sysname) // All libc functions are lowercase.
-
-			// Runtime import of function to allow cross-platform builds.
-			dynimports += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"%s.so\"\n", sysname, sysname, modname)
-			// Link symbol to proc address variable.
-			linknames += fmt.Sprintf("//go:linkname %s libc_%s\n", sysvarname, sysname)
-			// Library proc address variable.
-			vars = append(vars, sysvarname)
-
-			// Go function header.
-			outlist := strings.Join(out, ", ")
-			if outlist != "" {
-				outlist = fmt.Sprintf(" (%s)", outlist)
-			}
-			if text != "" {
-				text += "\n"
-			}
-			text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outlist)
-
-			// Check if err return available
-			errvar := ""
-			for _, param := range out {
-				p := parseParam(param)
-				if p.Type == "error" {
-					errvar = p.Name
-					continue
-				}
-			}
-
-			// Prepare arguments to Syscall.
-			var args []string
-			n := 0
-			for _, param := range in {
-				p := parseParam(param)
-				if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
-					args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))")
-				} else if p.Type == "string" && errvar != "" {
-					text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
-					text += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
-					text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
-					args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
-					n++
-				} else if p.Type == "string" {
-					fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
-					text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
-					text += fmt.Sprintf("\t_p%d, _ = %s(%s)\n", n, strconvfunc, p.Name)
-					args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
-					n++
-				} else if s := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); s != nil {
-					// Convert slice into pointer, length.
-					// Have to be careful not to take address of &a[0] if len == 0:
-					// pass nil in that case.
-					text += fmt.Sprintf("\tvar _p%d *%s\n", n, s[1])
-					text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
-					args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("uintptr(len(%s))", p.Name))
-					n++
-				} else if p.Type == "int64" && endianness != "" {
-					if endianness == "big-endian" {
-						args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
-					} else {
-						args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
-					}
-				} else if p.Type == "bool" {
-					text += fmt.Sprintf("\tvar _p%d uint32\n", n)
-					text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n)
-					args = append(args, fmt.Sprintf("uintptr(_p%d)", n))
-					n++
-				} else {
-					args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
-				}
-			}
-			nargs := len(args)
-
-			// Determine which form to use; pad args with zeros.
-			asm := "sysvicall6"
-			if nonblock != nil {
-				asm = "rawSysvicall6"
-			}
-			if len(args) <= 6 {
-				for len(args) < 6 {
-					args = append(args, "0")
-				}
-			} else {
-				fmt.Fprintf(os.Stderr, "%s: too many arguments to system call\n", path)
-				os.Exit(1)
-			}
-
-			// Actual call.
-			arglist := strings.Join(args, ", ")
-			call := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, arglist)
-
-			// Assign return values.
-			body := ""
-			ret := []string{"_", "_", "_"}
-			doErrno := false
-			for i := 0; i < len(out); i++ {
-				p := parseParam(out[i])
-				reg := ""
-				if p.Name == "err" {
-					reg = "e1"
-					ret[2] = reg
-					doErrno = true
-				} else {
-					reg = fmt.Sprintf("r%d", i)
-					ret[i] = reg
-				}
-				if p.Type == "bool" {
-					reg = fmt.Sprintf("%d != 0", reg)
-				}
-				if p.Type == "int64" && endianness != "" {
-					// 64-bit number in r1:r0 or r0:r1.
-					if i+2 > len(out) {
-						fmt.Fprintf(os.Stderr, "%s: not enough registers for int64 return\n", path)
-						os.Exit(1)
-					}
-					if endianness == "big-endian" {
-						reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1)
-					} else {
-						reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i)
-					}
-					ret[i] = fmt.Sprintf("r%d", i)
-					ret[i+1] = fmt.Sprintf("r%d", i+1)
-				}
-				if reg != "e1" {
-					body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
-				}
-			}
-			if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" {
-				text += fmt.Sprintf("\t%s\n", call)
-			} else {
-				text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call)
-			}
-			text += body
-
-			if doErrno {
-				text += "\tif e1 != 0 {\n"
-				text += "\t\terr = e1\n"
-				text += "\t}\n"
-			}
-			text += "\treturn\n"
-			text += "}\n"
-		}
-		if err := s.Err(); err != nil {
-			fmt.Fprintf(os.Stderr, err.Error())
-			os.Exit(1)
-		}
-		file.Close()
-	}
-	imp := ""
-	if pack != "unix" {
-		imp = "import \"golang.org/x/sys/unix\"\n"
-
-	}
-	vardecls := "\t" + strings.Join(vars, ",\n\t")
-	vardecls += " syscallFunc"
-	fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, text)
-}
-
-const srcTemplate = `// %s
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build %s
-
-package %s
-
-import (
-	"syscall"
-	"unsafe"
-)
-%s
-%s
-%s
-var (
-%s	
-)
-
-%s
-`
diff --git a/vendor/golang.org/x/sys/unix/mksysctl_openbsd.go b/vendor/golang.org/x/sys/unix/mksysctl_openbsd.go
deleted file mode 100644
index b6b4099..0000000
--- a/vendor/golang.org/x/sys/unix/mksysctl_openbsd.go
+++ /dev/null
@@ -1,355 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-// Parse the header files for OpenBSD and generate a Go usable sysctl MIB.
-//
-// Build a MIB with each entry being an array containing the level, type and
-// a hash that will contain additional entries if the current entry is a node.
-// We then walk this MIB and create a flattened sysctl name to OID hash.
-
-package main
-
-import (
-	"bufio"
-	"fmt"
-	"os"
-	"path/filepath"
-	"regexp"
-	"sort"
-	"strings"
-)
-
-var (
-	goos, goarch string
-)
-
-// cmdLine returns this programs's commandline arguments.
-func cmdLine() string {
-	return "go run mksysctl_openbsd.go " + strings.Join(os.Args[1:], " ")
-}
-
-// buildTags returns build tags.
-func buildTags() string {
-	return fmt.Sprintf("%s,%s", goarch, goos)
-}
-
-// reMatch performs regular expression match and stores the substring slice to value pointed by m.
-func reMatch(re *regexp.Regexp, str string, m *[]string) bool {
-	*m = re.FindStringSubmatch(str)
-	if *m != nil {
-		return true
-	}
-	return false
-}
-
-type nodeElement struct {
-	n  int
-	t  string
-	pE *map[string]nodeElement
-}
-
-var (
-	debugEnabled bool
-	mib          map[string]nodeElement
-	node         *map[string]nodeElement
-	nodeMap      map[string]string
-	sysCtl       []string
-)
-
-var (
-	ctlNames1RE = regexp.MustCompile(`^#define\s+(CTL_NAMES)\s+{`)
-	ctlNames2RE = regexp.MustCompile(`^#define\s+(CTL_(.*)_NAMES)\s+{`)
-	ctlNames3RE = regexp.MustCompile(`^#define\s+((.*)CTL_NAMES)\s+{`)
-	netInetRE   = regexp.MustCompile(`^netinet/`)
-	netInet6RE  = regexp.MustCompile(`^netinet6/`)
-	netRE       = regexp.MustCompile(`^net/`)
-	bracesRE    = regexp.MustCompile(`{.*}`)
-	ctlTypeRE   = regexp.MustCompile(`{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}`)
-	fsNetKernRE = regexp.MustCompile(`^(fs|net|kern)_`)
-)
-
-func debug(s string) {
-	if debugEnabled {
-		fmt.Fprintln(os.Stderr, s)
-	}
-}
-
-// Walk the MIB and build a sysctl name to OID mapping.
-func buildSysctl(pNode *map[string]nodeElement, name string, oid []int) {
-	lNode := pNode // local copy of pointer to node
-	var keys []string
-	for k := range *lNode {
-		keys = append(keys, k)
-	}
-	sort.Strings(keys)
-
-	for _, key := range keys {
-		nodename := name
-		if name != "" {
-			nodename += "."
-		}
-		nodename += key
-
-		nodeoid := append(oid, (*pNode)[key].n)
-
-		if (*pNode)[key].t == `CTLTYPE_NODE` {
-			if _, ok := nodeMap[nodename]; ok {
-				lNode = &mib
-				ctlName := nodeMap[nodename]
-				for _, part := range strings.Split(ctlName, ".") {
-					lNode = ((*lNode)[part]).pE
-				}
-			} else {
-				lNode = (*pNode)[key].pE
-			}
-			buildSysctl(lNode, nodename, nodeoid)
-		} else if (*pNode)[key].t != "" {
-			oidStr := []string{}
-			for j := range nodeoid {
-				oidStr = append(oidStr, fmt.Sprintf("%d", nodeoid[j]))
-			}
-			text := "\t{ \"" + nodename + "\", []_C_int{ " + strings.Join(oidStr, ", ") + " } }, \n"
-			sysCtl = append(sysCtl, text)
-		}
-	}
-}
-
-func main() {
-	// Get the OS (using GOOS_TARGET if it exist)
-	goos = os.Getenv("GOOS_TARGET")
-	if goos == "" {
-		goos = os.Getenv("GOOS")
-	}
-	// Get the architecture (using GOARCH_TARGET if it exists)
-	goarch = os.Getenv("GOARCH_TARGET")
-	if goarch == "" {
-		goarch = os.Getenv("GOARCH")
-	}
-	// Check if GOOS and GOARCH environment variables are defined
-	if goarch == "" || goos == "" {
-		fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n")
-		os.Exit(1)
-	}
-
-	mib = make(map[string]nodeElement)
-	headers := [...]string{
-		`sys/sysctl.h`,
-		`sys/socket.h`,
-		`sys/tty.h`,
-		`sys/malloc.h`,
-		`sys/mount.h`,
-		`sys/namei.h`,
-		`sys/sem.h`,
-		`sys/shm.h`,
-		`sys/vmmeter.h`,
-		`uvm/uvmexp.h`,
-		`uvm/uvm_param.h`,
-		`uvm/uvm_swap_encrypt.h`,
-		`ddb/db_var.h`,
-		`net/if.h`,
-		`net/if_pfsync.h`,
-		`net/pipex.h`,
-		`netinet/in.h`,
-		`netinet/icmp_var.h`,
-		`netinet/igmp_var.h`,
-		`netinet/ip_ah.h`,
-		`netinet/ip_carp.h`,
-		`netinet/ip_divert.h`,
-		`netinet/ip_esp.h`,
-		`netinet/ip_ether.h`,
-		`netinet/ip_gre.h`,
-		`netinet/ip_ipcomp.h`,
-		`netinet/ip_ipip.h`,
-		`netinet/pim_var.h`,
-		`netinet/tcp_var.h`,
-		`netinet/udp_var.h`,
-		`netinet6/in6.h`,
-		`netinet6/ip6_divert.h`,
-		`netinet6/pim6_var.h`,
-		`netinet/icmp6.h`,
-		`netmpls/mpls.h`,
-	}
-
-	ctls := [...]string{
-		`kern`,
-		`vm`,
-		`fs`,
-		`net`,
-		//debug			/* Special handling required */
-		`hw`,
-		//machdep		/* Arch specific */
-		`user`,
-		`ddb`,
-		//vfs			/* Special handling required */
-		`fs.posix`,
-		`kern.forkstat`,
-		`kern.intrcnt`,
-		`kern.malloc`,
-		`kern.nchstats`,
-		`kern.seminfo`,
-		`kern.shminfo`,
-		`kern.timecounter`,
-		`kern.tty`,
-		`kern.watchdog`,
-		`net.bpf`,
-		`net.ifq`,
-		`net.inet`,
-		`net.inet.ah`,
-		`net.inet.carp`,
-		`net.inet.divert`,
-		`net.inet.esp`,
-		`net.inet.etherip`,
-		`net.inet.gre`,
-		`net.inet.icmp`,
-		`net.inet.igmp`,
-		`net.inet.ip`,
-		`net.inet.ip.ifq`,
-		`net.inet.ipcomp`,
-		`net.inet.ipip`,
-		`net.inet.mobileip`,
-		`net.inet.pfsync`,
-		`net.inet.pim`,
-		`net.inet.tcp`,
-		`net.inet.udp`,
-		`net.inet6`,
-		`net.inet6.divert`,
-		`net.inet6.ip6`,
-		`net.inet6.icmp6`,
-		`net.inet6.pim6`,
-		`net.inet6.tcp6`,
-		`net.inet6.udp6`,
-		`net.mpls`,
-		`net.mpls.ifq`,
-		`net.key`,
-		`net.pflow`,
-		`net.pfsync`,
-		`net.pipex`,
-		`net.rt`,
-		`vm.swapencrypt`,
-		//vfsgenctl		/* Special handling required */
-	}
-
-	// Node name "fixups"
-	ctlMap := map[string]string{
-		"ipproto":             "net.inet",
-		"net.inet.ipproto":    "net.inet",
-		"net.inet6.ipv6proto": "net.inet6",
-		"net.inet6.ipv6":      "net.inet6.ip6",
-		"net.inet.icmpv6":     "net.inet6.icmp6",
-		"net.inet6.divert6":   "net.inet6.divert",
-		"net.inet6.tcp6":      "net.inet.tcp",
-		"net.inet6.udp6":      "net.inet.udp",
-		"mpls":                "net.mpls",
-		"swpenc":              "vm.swapencrypt",
-	}
-
-	// Node mappings
-	nodeMap = map[string]string{
-		"net.inet.ip.ifq": "net.ifq",
-		"net.inet.pfsync": "net.pfsync",
-		"net.mpls.ifq":    "net.ifq",
-	}
-
-	mCtls := make(map[string]bool)
-	for _, ctl := range ctls {
-		mCtls[ctl] = true
-	}
-
-	for _, header := range headers {
-		debug("Processing " + header)
-		file, err := os.Open(filepath.Join("/usr/include", header))
-		if err != nil {
-			fmt.Fprintf(os.Stderr, "%v\n", err)
-			os.Exit(1)
-		}
-		s := bufio.NewScanner(file)
-		for s.Scan() {
-			var sub []string
-			if reMatch(ctlNames1RE, s.Text(), &sub) ||
-				reMatch(ctlNames2RE, s.Text(), &sub) ||
-				reMatch(ctlNames3RE, s.Text(), &sub) {
-				if sub[1] == `CTL_NAMES` {
-					// Top level.
-					node = &mib
-				} else {
-					// Node.
-					nodename := strings.ToLower(sub[2])
-					ctlName := ""
-					if reMatch(netInetRE, header, &sub) {
-						ctlName = "net.inet." + nodename
-					} else if reMatch(netInet6RE, header, &sub) {
-						ctlName = "net.inet6." + nodename
-					} else if reMatch(netRE, header, &sub) {
-						ctlName = "net." + nodename
-					} else {
-						ctlName = nodename
-						ctlName = fsNetKernRE.ReplaceAllString(ctlName, `$1.`)
-					}
-
-					if val, ok := ctlMap[ctlName]; ok {
-						ctlName = val
-					}
-					if _, ok := mCtls[ctlName]; !ok {
-						debug("Ignoring " + ctlName + "...")
-						continue
-					}
-
-					// Walk down from the top of the MIB.
-					node = &mib
-					for _, part := range strings.Split(ctlName, ".") {
-						if _, ok := (*node)[part]; !ok {
-							debug("Missing node " + part)
-							(*node)[part] = nodeElement{n: 0, t: "", pE: &map[string]nodeElement{}}
-						}
-						node = (*node)[part].pE
-					}
-				}
-
-				// Populate current node with entries.
-				i := -1
-				for !strings.HasPrefix(s.Text(), "}") {
-					s.Scan()
-					if reMatch(bracesRE, s.Text(), &sub) {
-						i++
-					}
-					if !reMatch(ctlTypeRE, s.Text(), &sub) {
-						continue
-					}
-					(*node)[sub[1]] = nodeElement{n: i, t: sub[2], pE: &map[string]nodeElement{}}
-				}
-			}
-		}
-		err = s.Err()
-		if err != nil {
-			fmt.Fprintf(os.Stderr, "%v\n", err)
-			os.Exit(1)
-		}
-		file.Close()
-	}
-	buildSysctl(&mib, "", []int{})
-
-	sort.Strings(sysCtl)
-	text := strings.Join(sysCtl, "")
-
-	fmt.Printf(srcTemplate, cmdLine(), buildTags(), text)
-}
-
-const srcTemplate = `// %s
-// Code generated by the command above; DO NOT EDIT.
-
-// +build %s
-
-package unix
-
-type mibentry struct {
-	ctlname string
-	ctloid []_C_int
-}
-
-var sysctlMib = []mibentry {
-%s
-}
-`
diff --git a/vendor/golang.org/x/sys/unix/mksysnum.go b/vendor/golang.org/x/sys/unix/mksysnum.go
deleted file mode 100644
index baa6ecd..0000000
--- a/vendor/golang.org/x/sys/unix/mksysnum.go
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-// Generate system call table for DragonFly, NetBSD,
-// FreeBSD, OpenBSD or Darwin from master list
-// (for example, /usr/src/sys/kern/syscalls.master or
-// sys/syscall.h).
-package main
-
-import (
-	"bufio"
-	"fmt"
-	"io"
-	"io/ioutil"
-	"net/http"
-	"os"
-	"regexp"
-	"strings"
-)
-
-var (
-	goos, goarch string
-)
-
-// cmdLine returns this programs's commandline arguments
-func cmdLine() string {
-	return "go run mksysnum.go " + strings.Join(os.Args[1:], " ")
-}
-
-// buildTags returns build tags
-func buildTags() string {
-	return fmt.Sprintf("%s,%s", goarch, goos)
-}
-
-func checkErr(err error) {
-	if err != nil {
-		fmt.Fprintf(os.Stderr, "%v\n", err)
-		os.Exit(1)
-	}
-}
-
-// source string and substring slice for regexp
-type re struct {
-	str string   // source string
-	sub []string // matched sub-string
-}
-
-// Match performs regular expression match
-func (r *re) Match(exp string) bool {
-	r.sub = regexp.MustCompile(exp).FindStringSubmatch(r.str)
-	if r.sub != nil {
-		return true
-	}
-	return false
-}
-
-// fetchFile fetches a text file from URL
-func fetchFile(URL string) io.Reader {
-	resp, err := http.Get(URL)
-	checkErr(err)
-	defer resp.Body.Close()
-	body, err := ioutil.ReadAll(resp.Body)
-	checkErr(err)
-	return strings.NewReader(string(body))
-}
-
-// readFile reads a text file from path
-func readFile(path string) io.Reader {
-	file, err := os.Open(os.Args[1])
-	checkErr(err)
-	return file
-}
-
-func format(name, num, proto string) string {
-	name = strings.ToUpper(name)
-	// There are multiple entries for enosys and nosys, so comment them out.
-	nm := re{str: name}
-	if nm.Match(`^SYS_E?NOSYS$`) {
-		name = fmt.Sprintf("// %s", name)
-	}
-	if name == `SYS_SYS_EXIT` {
-		name = `SYS_EXIT`
-	}
-	return fmt.Sprintf("	%s = %s;  // %s\n", name, num, proto)
-}
-
-func main() {
-	// Get the OS (using GOOS_TARGET if it exist)
-	goos = os.Getenv("GOOS_TARGET")
-	if goos == "" {
-		goos = os.Getenv("GOOS")
-	}
-	// Get the architecture (using GOARCH_TARGET if it exists)
-	goarch = os.Getenv("GOARCH_TARGET")
-	if goarch == "" {
-		goarch = os.Getenv("GOARCH")
-	}
-	// Check if GOOS and GOARCH environment variables are defined
-	if goarch == "" || goos == "" {
-		fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n")
-		os.Exit(1)
-	}
-
-	file := strings.TrimSpace(os.Args[1])
-	var syscalls io.Reader
-	if strings.HasPrefix(file, "https://") || strings.HasPrefix(file, "http://") {
-		// Download syscalls.master file
-		syscalls = fetchFile(file)
-	} else {
-		syscalls = readFile(file)
-	}
-
-	var text, line string
-	s := bufio.NewScanner(syscalls)
-	for s.Scan() {
-		t := re{str: line}
-		if t.Match(`^(.*)\\$`) {
-			// Handle continuation
-			line = t.sub[1]
-			line += strings.TrimLeft(s.Text(), " \t")
-		} else {
-			// New line
-			line = s.Text()
-		}
-		t = re{str: line}
-		if t.Match(`\\$`) {
-			continue
-		}
-		t = re{str: line}
-
-		switch goos {
-		case "dragonfly":
-			if t.Match(`^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$`) {
-				num, proto := t.sub[1], t.sub[2]
-				name := fmt.Sprintf("SYS_%s", t.sub[3])
-				text += format(name, num, proto)
-			}
-		case "freebsd":
-			if t.Match(`^([0-9]+)\s+\S+\s+(?:(?:NO)?STD|COMPAT10)\s+({ \S+\s+(\w+).*)$`) {
-				num, proto := t.sub[1], t.sub[2]
-				name := fmt.Sprintf("SYS_%s", t.sub[3])
-				text += format(name, num, proto)
-			}
-		case "openbsd":
-			if t.Match(`^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$`) {
-				num, proto, name := t.sub[1], t.sub[3], t.sub[4]
-				text += format(name, num, proto)
-			}
-		case "netbsd":
-			if t.Match(`^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$`) {
-				num, proto, compat := t.sub[1], t.sub[6], t.sub[8]
-				name := t.sub[7] + "_" + t.sub[9]
-				if t.sub[11] != "" {
-					name = t.sub[7] + "_" + t.sub[11]
-				}
-				name = strings.ToUpper(name)
-				if compat == "" || compat == "13" || compat == "30" || compat == "50" {
-					text += fmt.Sprintf("	%s = %s;  // %s\n", name, num, proto)
-				}
-			}
-		case "darwin":
-			if t.Match(`^#define\s+SYS_(\w+)\s+([0-9]+)`) {
-				name, num := t.sub[1], t.sub[2]
-				name = strings.ToUpper(name)
-				text += fmt.Sprintf("	SYS_%s = %s;\n", name, num)
-			}
-		default:
-			fmt.Fprintf(os.Stderr, "unrecognized GOOS=%s\n", goos)
-			os.Exit(1)
-
-		}
-	}
-	err := s.Err()
-	checkErr(err)
-
-	fmt.Printf(template, cmdLine(), buildTags(), text)
-}
-
-const template = `// %s
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build %s
-
-package unix
-
-const(
-%s)`
diff --git a/vendor/golang.org/x/sys/unix/types_aix.go b/vendor/golang.org/x/sys/unix/types_aix.go
deleted file mode 100644
index 40d2bee..0000000
--- a/vendor/golang.org/x/sys/unix/types_aix.go
+++ /dev/null
@@ -1,237 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-// +build aix
-
-/*
-Input to cgo -godefs.  See also mkerrors.sh and mkall.sh
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/limits.h>
-#include <sys/un.h>
-#include <utime.h>
-#include <sys/utsname.h>
-#include <sys/poll.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/statfs.h>
-#include <sys/termio.h>
-#include <sys/ioctl.h>
-
-#include <termios.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <netinet/in.h>
-#include <netinet/icmp6.h>
-
-
-#include <dirent.h>
-#include <fcntl.h>
-
-enum {
-	sizeofPtr = sizeof(void*),
-};
-
-union sockaddr_all {
-	struct sockaddr s1;     // this one gets used for fields
-	struct sockaddr_in s2;  // these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-*/
-import "C"
-
-// Machine characteristics
-
-const (
-	SizeofPtr      = C.sizeofPtr
-	SizeofShort    = C.sizeof_short
-	SizeofInt      = C.sizeof_int
-	SizeofLong     = C.sizeof_long
-	SizeofLongLong = C.sizeof_longlong
-	PathMax        = C.PATH_MAX
-)
-
-// Basic types
-
-type (
-	_C_short     C.short
-	_C_int       C.int
-	_C_long      C.long
-	_C_long_long C.longlong
-)
-
-type off64 C.off64_t
-type off C.off_t
-type Mode_t C.mode_t
-
-// Time
-
-type Timespec C.struct_timespec
-
-type Timeval C.struct_timeval
-
-type Timeval32 C.struct_timeval32
-
-type Timex C.struct_timex
-
-type Time_t C.time_t
-
-type Tms C.struct_tms
-
-type Utimbuf C.struct_utimbuf
-
-type Timezone C.struct_timezone
-
-// Processes
-
-type Rusage C.struct_rusage
-
-type Rlimit C.struct_rlimit64
-
-type Pid_t C.pid_t
-
-type _Gid_t C.gid_t
-
-type dev_t C.dev_t
-
-// Files
-
-type Stat_t C.struct_stat
-
-type StatxTimestamp C.struct_statx_timestamp
-
-type Statx_t C.struct_statx
-
-type Dirent C.struct_dirent
-
-// Sockets
-
-type RawSockaddrInet4 C.struct_sockaddr_in
-
-type RawSockaddrInet6 C.struct_sockaddr_in6
-
-type RawSockaddrUnix C.struct_sockaddr_un
-
-type RawSockaddrDatalink C.struct_sockaddr_dl
-
-type RawSockaddr C.struct_sockaddr
-
-type RawSockaddrAny C.struct_sockaddr_any
-
-type _Socklen C.socklen_t
-
-type Cmsghdr C.struct_cmsghdr
-
-type ICMPv6Filter C.struct_icmp6_filter
-
-type Iovec C.struct_iovec
-
-type IPMreq C.struct_ip_mreq
-
-type IPv6Mreq C.struct_ipv6_mreq
-
-type IPv6MTUInfo C.struct_ip6_mtuinfo
-
-type Linger C.struct_linger
-
-type Msghdr C.struct_msghdr
-
-const (
-	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
-	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
-	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
-	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
-	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
-	SizeofLinger           = C.sizeof_struct_linger
-	SizeofIPMreq           = C.sizeof_struct_ip_mreq
-	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
-	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
-	SizeofMsghdr           = C.sizeof_struct_msghdr
-	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
-	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
-)
-
-// Routing and interface messages
-
-const (
-	SizeofIfMsghdr = C.sizeof_struct_if_msghdr
-)
-
-type IfMsgHdr C.struct_if_msghdr
-
-// Misc
-
-type FdSet C.fd_set
-
-type Utsname C.struct_utsname
-
-type Ustat_t C.struct_ustat
-
-type Sigset_t C.sigset_t
-
-const (
-	AT_FDCWD            = C.AT_FDCWD
-	AT_REMOVEDIR        = C.AT_REMOVEDIR
-	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
-)
-
-// Terminal handling
-
-type Termios C.struct_termios
-
-type Termio C.struct_termio
-
-type Winsize C.struct_winsize
-
-//poll
-
-type PollFd struct {
-	Fd      int32
-	Events  uint16
-	Revents uint16
-}
-
-const (
-	POLLERR    = C.POLLERR
-	POLLHUP    = C.POLLHUP
-	POLLIN     = C.POLLIN
-	POLLNVAL   = C.POLLNVAL
-	POLLOUT    = C.POLLOUT
-	POLLPRI    = C.POLLPRI
-	POLLRDBAND = C.POLLRDBAND
-	POLLRDNORM = C.POLLRDNORM
-	POLLWRBAND = C.POLLWRBAND
-	POLLWRNORM = C.POLLWRNORM
-)
-
-//flock_t
-
-type Flock_t C.struct_flock64
-
-// Statfs
-
-type Fsid_t C.struct_fsid_t
-type Fsid64_t C.struct_fsid64_t
-
-type Statfs_t C.struct_statfs
-
-const RNDGETENTCNT = 0x80045200
diff --git a/vendor/golang.org/x/sys/unix/types_darwin.go b/vendor/golang.org/x/sys/unix/types_darwin.go
deleted file mode 100644
index 155c2e6..0000000
--- a/vendor/golang.org/x/sys/unix/types_darwin.go
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-Input to cgo -godefs.  See README.md
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#define __DARWIN_UNIX03 0
-#define KERNEL
-#define _DARWIN_USE_64_BIT_INODE
-#include <dirent.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <signal.h>
-#include <termios.h>
-#include <unistd.h>
-#include <mach/mach.h>
-#include <mach/message.h>
-#include <sys/event.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_var.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/icmp6.h>
-#include <netinet/tcp.h>
-
-enum {
-	sizeofPtr = sizeof(void*),
-};
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-*/
-import "C"
-
-// Machine characteristics
-
-const (
-	SizeofPtr      = C.sizeofPtr
-	SizeofShort    = C.sizeof_short
-	SizeofInt      = C.sizeof_int
-	SizeofLong     = C.sizeof_long
-	SizeofLongLong = C.sizeof_longlong
-)
-
-// Basic types
-
-type (
-	_C_short     C.short
-	_C_int       C.int
-	_C_long      C.long
-	_C_long_long C.longlong
-)
-
-// Time
-
-type Timespec C.struct_timespec
-
-type Timeval C.struct_timeval
-
-type Timeval32 C.struct_timeval32
-
-// Processes
-
-type Rusage C.struct_rusage
-
-type Rlimit C.struct_rlimit
-
-type _Gid_t C.gid_t
-
-// Files
-
-type Stat_t C.struct_stat64
-
-type Statfs_t C.struct_statfs64
-
-type Flock_t C.struct_flock
-
-type Fstore_t C.struct_fstore
-
-type Radvisory_t C.struct_radvisory
-
-type Fbootstraptransfer_t C.struct_fbootstraptransfer
-
-type Log2phys_t C.struct_log2phys
-
-type Fsid C.struct_fsid
-
-type Dirent C.struct_dirent
-
-// Sockets
-
-type RawSockaddrInet4 C.struct_sockaddr_in
-
-type RawSockaddrInet6 C.struct_sockaddr_in6
-
-type RawSockaddrUnix C.struct_sockaddr_un
-
-type RawSockaddrDatalink C.struct_sockaddr_dl
-
-type RawSockaddr C.struct_sockaddr
-
-type RawSockaddrAny C.struct_sockaddr_any
-
-type _Socklen C.socklen_t
-
-type Linger C.struct_linger
-
-type Iovec C.struct_iovec
-
-type IPMreq C.struct_ip_mreq
-
-type IPv6Mreq C.struct_ipv6_mreq
-
-type Msghdr C.struct_msghdr
-
-type Cmsghdr C.struct_cmsghdr
-
-type Inet4Pktinfo C.struct_in_pktinfo
-
-type Inet6Pktinfo C.struct_in6_pktinfo
-
-type IPv6MTUInfo C.struct_ip6_mtuinfo
-
-type ICMPv6Filter C.struct_icmp6_filter
-
-const (
-	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
-	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
-	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
-	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
-	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
-	SizeofLinger           = C.sizeof_struct_linger
-	SizeofIPMreq           = C.sizeof_struct_ip_mreq
-	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
-	SizeofMsghdr           = C.sizeof_struct_msghdr
-	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
-	SizeofInet4Pktinfo     = C.sizeof_struct_in_pktinfo
-	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
-	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
-	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
-)
-
-// Ptrace requests
-
-const (
-	PTRACE_TRACEME = C.PT_TRACE_ME
-	PTRACE_CONT    = C.PT_CONTINUE
-	PTRACE_KILL    = C.PT_KILL
-)
-
-// Events (kqueue, kevent)
-
-type Kevent_t C.struct_kevent
-
-// Select
-
-type FdSet C.fd_set
-
-// Routing and interface messages
-
-const (
-	SizeofIfMsghdr    = C.sizeof_struct_if_msghdr
-	SizeofIfData      = C.sizeof_struct_if_data
-	SizeofIfaMsghdr   = C.sizeof_struct_ifa_msghdr
-	SizeofIfmaMsghdr  = C.sizeof_struct_ifma_msghdr
-	SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2
-	SizeofRtMsghdr    = C.sizeof_struct_rt_msghdr
-	SizeofRtMetrics   = C.sizeof_struct_rt_metrics
-)
-
-type IfMsghdr C.struct_if_msghdr
-
-type IfData C.struct_if_data
-
-type IfaMsghdr C.struct_ifa_msghdr
-
-type IfmaMsghdr C.struct_ifma_msghdr
-
-type IfmaMsghdr2 C.struct_ifma_msghdr2
-
-type RtMsghdr C.struct_rt_msghdr
-
-type RtMetrics C.struct_rt_metrics
-
-// Berkeley packet filter
-
-const (
-	SizeofBpfVersion = C.sizeof_struct_bpf_version
-	SizeofBpfStat    = C.sizeof_struct_bpf_stat
-	SizeofBpfProgram = C.sizeof_struct_bpf_program
-	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
-	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
-)
-
-type BpfVersion C.struct_bpf_version
-
-type BpfStat C.struct_bpf_stat
-
-type BpfProgram C.struct_bpf_program
-
-type BpfInsn C.struct_bpf_insn
-
-type BpfHdr C.struct_bpf_hdr
-
-// Terminal handling
-
-type Termios C.struct_termios
-
-type Winsize C.struct_winsize
-
-// fchmodat-like syscalls.
-
-const (
-	AT_FDCWD            = C.AT_FDCWD
-	AT_REMOVEDIR        = C.AT_REMOVEDIR
-	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
-	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
-)
-
-// poll
-
-type PollFd C.struct_pollfd
-
-const (
-	POLLERR    = C.POLLERR
-	POLLHUP    = C.POLLHUP
-	POLLIN     = C.POLLIN
-	POLLNVAL   = C.POLLNVAL
-	POLLOUT    = C.POLLOUT
-	POLLPRI    = C.POLLPRI
-	POLLRDBAND = C.POLLRDBAND
-	POLLRDNORM = C.POLLRDNORM
-	POLLWRBAND = C.POLLWRBAND
-	POLLWRNORM = C.POLLWRNORM
-)
-
-// uname
-
-type Utsname C.struct_utsname
-
-// Clockinfo
-
-const SizeofClockinfo = C.sizeof_struct_clockinfo
-
-type Clockinfo C.struct_clockinfo
diff --git a/vendor/golang.org/x/sys/unix/types_dragonfly.go b/vendor/golang.org/x/sys/unix/types_dragonfly.go
deleted file mode 100644
index 3365dd7..0000000
--- a/vendor/golang.org/x/sys/unix/types_dragonfly.go
+++ /dev/null
@@ -1,263 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-Input to cgo -godefs.  See README.md
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#define KERNEL
-#include <dirent.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <signal.h>
-#include <termios.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/event.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/icmp6.h>
-#include <netinet/tcp.h>
-
-enum {
-	sizeofPtr = sizeof(void*),
-};
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-*/
-import "C"
-
-// Machine characteristics
-
-const (
-	SizeofPtr      = C.sizeofPtr
-	SizeofShort    = C.sizeof_short
-	SizeofInt      = C.sizeof_int
-	SizeofLong     = C.sizeof_long
-	SizeofLongLong = C.sizeof_longlong
-)
-
-// Basic types
-
-type (
-	_C_short     C.short
-	_C_int       C.int
-	_C_long      C.long
-	_C_long_long C.longlong
-)
-
-// Time
-
-type Timespec C.struct_timespec
-
-type Timeval C.struct_timeval
-
-// Processes
-
-type Rusage C.struct_rusage
-
-type Rlimit C.struct_rlimit
-
-type _Gid_t C.gid_t
-
-// Files
-
-type Stat_t C.struct_stat
-
-type Statfs_t C.struct_statfs
-
-type Flock_t C.struct_flock
-
-type Dirent C.struct_dirent
-
-type Fsid C.struct_fsid
-
-// File system limits
-
-const (
-	PathMax = C.PATH_MAX
-)
-
-// Sockets
-
-type RawSockaddrInet4 C.struct_sockaddr_in
-
-type RawSockaddrInet6 C.struct_sockaddr_in6
-
-type RawSockaddrUnix C.struct_sockaddr_un
-
-type RawSockaddrDatalink C.struct_sockaddr_dl
-
-type RawSockaddr C.struct_sockaddr
-
-type RawSockaddrAny C.struct_sockaddr_any
-
-type _Socklen C.socklen_t
-
-type Linger C.struct_linger
-
-type Iovec C.struct_iovec
-
-type IPMreq C.struct_ip_mreq
-
-type IPv6Mreq C.struct_ipv6_mreq
-
-type Msghdr C.struct_msghdr
-
-type Cmsghdr C.struct_cmsghdr
-
-type Inet6Pktinfo C.struct_in6_pktinfo
-
-type IPv6MTUInfo C.struct_ip6_mtuinfo
-
-type ICMPv6Filter C.struct_icmp6_filter
-
-const (
-	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
-	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
-	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
-	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
-	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
-	SizeofLinger           = C.sizeof_struct_linger
-	SizeofIPMreq           = C.sizeof_struct_ip_mreq
-	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
-	SizeofMsghdr           = C.sizeof_struct_msghdr
-	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
-	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
-	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
-	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
-)
-
-// Ptrace requests
-
-const (
-	PTRACE_TRACEME = C.PT_TRACE_ME
-	PTRACE_CONT    = C.PT_CONTINUE
-	PTRACE_KILL    = C.PT_KILL
-)
-
-// Events (kqueue, kevent)
-
-type Kevent_t C.struct_kevent
-
-// Select
-
-type FdSet C.fd_set
-
-// Routing and interface messages
-
-const (
-	SizeofIfMsghdr         = C.sizeof_struct_if_msghdr
-	SizeofIfData           = C.sizeof_struct_if_data
-	SizeofIfaMsghdr        = C.sizeof_struct_ifa_msghdr
-	SizeofIfmaMsghdr       = C.sizeof_struct_ifma_msghdr
-	SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
-	SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
-	SizeofRtMetrics        = C.sizeof_struct_rt_metrics
-)
-
-type IfMsghdr C.struct_if_msghdr
-
-type IfData C.struct_if_data
-
-type IfaMsghdr C.struct_ifa_msghdr
-
-type IfmaMsghdr C.struct_ifma_msghdr
-
-type IfAnnounceMsghdr C.struct_if_announcemsghdr
-
-type RtMsghdr C.struct_rt_msghdr
-
-type RtMetrics C.struct_rt_metrics
-
-// Berkeley packet filter
-
-const (
-	SizeofBpfVersion = C.sizeof_struct_bpf_version
-	SizeofBpfStat    = C.sizeof_struct_bpf_stat
-	SizeofBpfProgram = C.sizeof_struct_bpf_program
-	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
-	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
-)
-
-type BpfVersion C.struct_bpf_version
-
-type BpfStat C.struct_bpf_stat
-
-type BpfProgram C.struct_bpf_program
-
-type BpfInsn C.struct_bpf_insn
-
-type BpfHdr C.struct_bpf_hdr
-
-// Terminal handling
-
-type Termios C.struct_termios
-
-type Winsize C.struct_winsize
-
-// fchmodat-like syscalls.
-
-const (
-	AT_FDCWD            = C.AT_FDCWD
-	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
-)
-
-// poll
-
-type PollFd C.struct_pollfd
-
-const (
-	POLLERR    = C.POLLERR
-	POLLHUP    = C.POLLHUP
-	POLLIN     = C.POLLIN
-	POLLNVAL   = C.POLLNVAL
-	POLLOUT    = C.POLLOUT
-	POLLPRI    = C.POLLPRI
-	POLLRDBAND = C.POLLRDBAND
-	POLLRDNORM = C.POLLRDNORM
-	POLLWRBAND = C.POLLWRBAND
-	POLLWRNORM = C.POLLWRNORM
-)
-
-// Uname
-
-type Utsname C.struct_utsname
diff --git a/vendor/golang.org/x/sys/unix/types_freebsd.go b/vendor/golang.org/x/sys/unix/types_freebsd.go
deleted file mode 100644
index a121dc3..0000000
--- a/vendor/golang.org/x/sys/unix/types_freebsd.go
+++ /dev/null
@@ -1,400 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-Input to cgo -godefs.  See README.md
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#define	_WANT_FREEBSD11_STAT	1
-#define	_WANT_FREEBSD11_STATFS	1
-#define	_WANT_FREEBSD11_DIRENT	1
-#define	_WANT_FREEBSD11_KEVENT  1
-
-#include <dirent.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <signal.h>
-#include <termios.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/capsicum.h>
-#include <sys/event.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/icmp6.h>
-#include <netinet/tcp.h>
-
-enum {
-	sizeofPtr = sizeof(void*),
-};
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-// This structure is a duplicate of if_data on FreeBSD 8-STABLE.
-// See /usr/include/net/if.h.
-struct if_data8 {
-	u_char  ifi_type;
-	u_char  ifi_physical;
-	u_char  ifi_addrlen;
-	u_char  ifi_hdrlen;
-	u_char  ifi_link_state;
-	u_char  ifi_spare_char1;
-	u_char  ifi_spare_char2;
-	u_char  ifi_datalen;
-	u_long  ifi_mtu;
-	u_long  ifi_metric;
-	u_long  ifi_baudrate;
-	u_long  ifi_ipackets;
-	u_long  ifi_ierrors;
-	u_long  ifi_opackets;
-	u_long  ifi_oerrors;
-	u_long  ifi_collisions;
-	u_long  ifi_ibytes;
-	u_long  ifi_obytes;
-	u_long  ifi_imcasts;
-	u_long  ifi_omcasts;
-	u_long  ifi_iqdrops;
-	u_long  ifi_noproto;
-	u_long  ifi_hwassist;
-// FIXME: these are now unions, so maybe need to change definitions?
-#undef ifi_epoch
-	time_t  ifi_epoch;
-#undef ifi_lastchange
-	struct  timeval ifi_lastchange;
-};
-
-// This structure is a duplicate of if_msghdr on FreeBSD 8-STABLE.
-// See /usr/include/net/if.h.
-struct if_msghdr8 {
-	u_short ifm_msglen;
-	u_char  ifm_version;
-	u_char  ifm_type;
-	int     ifm_addrs;
-	int     ifm_flags;
-	u_short ifm_index;
-	struct  if_data8 ifm_data;
-};
-*/
-import "C"
-
-// Machine characteristics
-
-const (
-	SizeofPtr      = C.sizeofPtr
-	SizeofShort    = C.sizeof_short
-	SizeofInt      = C.sizeof_int
-	SizeofLong     = C.sizeof_long
-	SizeofLongLong = C.sizeof_longlong
-)
-
-// Basic types
-
-type (
-	_C_short     C.short
-	_C_int       C.int
-	_C_long      C.long
-	_C_long_long C.longlong
-)
-
-// Time
-
-type Timespec C.struct_timespec
-
-type Timeval C.struct_timeval
-
-// Processes
-
-type Rusage C.struct_rusage
-
-type Rlimit C.struct_rlimit
-
-type _Gid_t C.gid_t
-
-// Files
-
-const (
-	_statfsVersion = C.STATFS_VERSION
-	_dirblksiz     = C.DIRBLKSIZ
-)
-
-type Stat_t C.struct_stat
-
-type stat_freebsd11_t C.struct_freebsd11_stat
-
-type Statfs_t C.struct_statfs
-
-type statfs_freebsd11_t C.struct_freebsd11_statfs
-
-type Flock_t C.struct_flock
-
-type Dirent C.struct_dirent
-
-type dirent_freebsd11 C.struct_freebsd11_dirent
-
-type Fsid C.struct_fsid
-
-// File system limits
-
-const (
-	PathMax = C.PATH_MAX
-)
-
-// Advice to Fadvise
-
-const (
-	FADV_NORMAL     = C.POSIX_FADV_NORMAL
-	FADV_RANDOM     = C.POSIX_FADV_RANDOM
-	FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
-	FADV_WILLNEED   = C.POSIX_FADV_WILLNEED
-	FADV_DONTNEED   = C.POSIX_FADV_DONTNEED
-	FADV_NOREUSE    = C.POSIX_FADV_NOREUSE
-)
-
-// Sockets
-
-type RawSockaddrInet4 C.struct_sockaddr_in
-
-type RawSockaddrInet6 C.struct_sockaddr_in6
-
-type RawSockaddrUnix C.struct_sockaddr_un
-
-type RawSockaddrDatalink C.struct_sockaddr_dl
-
-type RawSockaddr C.struct_sockaddr
-
-type RawSockaddrAny C.struct_sockaddr_any
-
-type _Socklen C.socklen_t
-
-type Linger C.struct_linger
-
-type Iovec C.struct_iovec
-
-type IPMreq C.struct_ip_mreq
-
-type IPMreqn C.struct_ip_mreqn
-
-type IPv6Mreq C.struct_ipv6_mreq
-
-type Msghdr C.struct_msghdr
-
-type Cmsghdr C.struct_cmsghdr
-
-type Inet6Pktinfo C.struct_in6_pktinfo
-
-type IPv6MTUInfo C.struct_ip6_mtuinfo
-
-type ICMPv6Filter C.struct_icmp6_filter
-
-const (
-	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
-	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
-	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
-	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
-	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
-	SizeofLinger           = C.sizeof_struct_linger
-	SizeofIPMreq           = C.sizeof_struct_ip_mreq
-	SizeofIPMreqn          = C.sizeof_struct_ip_mreqn
-	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
-	SizeofMsghdr           = C.sizeof_struct_msghdr
-	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
-	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
-	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
-	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
-)
-
-// Ptrace requests
-
-const (
-	PTRACE_ATTACH     = C.PT_ATTACH
-	PTRACE_CONT       = C.PT_CONTINUE
-	PTRACE_DETACH     = C.PT_DETACH
-	PTRACE_GETFPREGS  = C.PT_GETFPREGS
-	PTRACE_GETFSBASE  = C.PT_GETFSBASE
-	PTRACE_GETLWPLIST = C.PT_GETLWPLIST
-	PTRACE_GETNUMLWPS = C.PT_GETNUMLWPS
-	PTRACE_GETREGS    = C.PT_GETREGS
-	PTRACE_GETXSTATE  = C.PT_GETXSTATE
-	PTRACE_IO         = C.PT_IO
-	PTRACE_KILL       = C.PT_KILL
-	PTRACE_LWPEVENTS  = C.PT_LWP_EVENTS
-	PTRACE_LWPINFO    = C.PT_LWPINFO
-	PTRACE_SETFPREGS  = C.PT_SETFPREGS
-	PTRACE_SETREGS    = C.PT_SETREGS
-	PTRACE_SINGLESTEP = C.PT_STEP
-	PTRACE_TRACEME    = C.PT_TRACE_ME
-)
-
-const (
-	PIOD_READ_D  = C.PIOD_READ_D
-	PIOD_WRITE_D = C.PIOD_WRITE_D
-	PIOD_READ_I  = C.PIOD_READ_I
-	PIOD_WRITE_I = C.PIOD_WRITE_I
-)
-
-const (
-	PL_FLAG_BORN   = C.PL_FLAG_BORN
-	PL_FLAG_EXITED = C.PL_FLAG_EXITED
-	PL_FLAG_SI     = C.PL_FLAG_SI
-)
-
-const (
-	TRAP_BRKPT = C.TRAP_BRKPT
-	TRAP_TRACE = C.TRAP_TRACE
-)
-
-type PtraceLwpInfoStruct C.struct_ptrace_lwpinfo
-
-type __Siginfo C.struct___siginfo
-
-type Sigset_t C.sigset_t
-
-type Reg C.struct_reg
-
-type FpReg C.struct_fpreg
-
-type PtraceIoDesc C.struct_ptrace_io_desc
-
-// Events (kqueue, kevent)
-
-type Kevent_t C.struct_kevent_freebsd11
-
-// Select
-
-type FdSet C.fd_set
-
-// Routing and interface messages
-
-const (
-	sizeofIfMsghdr         = C.sizeof_struct_if_msghdr
-	SizeofIfMsghdr         = C.sizeof_struct_if_msghdr8
-	sizeofIfData           = C.sizeof_struct_if_data
-	SizeofIfData           = C.sizeof_struct_if_data8
-	SizeofIfaMsghdr        = C.sizeof_struct_ifa_msghdr
-	SizeofIfmaMsghdr       = C.sizeof_struct_ifma_msghdr
-	SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
-	SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
-	SizeofRtMetrics        = C.sizeof_struct_rt_metrics
-)
-
-type ifMsghdr C.struct_if_msghdr
-
-type IfMsghdr C.struct_if_msghdr8
-
-type ifData C.struct_if_data
-
-type IfData C.struct_if_data8
-
-type IfaMsghdr C.struct_ifa_msghdr
-
-type IfmaMsghdr C.struct_ifma_msghdr
-
-type IfAnnounceMsghdr C.struct_if_announcemsghdr
-
-type RtMsghdr C.struct_rt_msghdr
-
-type RtMetrics C.struct_rt_metrics
-
-// Berkeley packet filter
-
-const (
-	SizeofBpfVersion    = C.sizeof_struct_bpf_version
-	SizeofBpfStat       = C.sizeof_struct_bpf_stat
-	SizeofBpfZbuf       = C.sizeof_struct_bpf_zbuf
-	SizeofBpfProgram    = C.sizeof_struct_bpf_program
-	SizeofBpfInsn       = C.sizeof_struct_bpf_insn
-	SizeofBpfHdr        = C.sizeof_struct_bpf_hdr
-	SizeofBpfZbufHeader = C.sizeof_struct_bpf_zbuf_header
-)
-
-type BpfVersion C.struct_bpf_version
-
-type BpfStat C.struct_bpf_stat
-
-type BpfZbuf C.struct_bpf_zbuf
-
-type BpfProgram C.struct_bpf_program
-
-type BpfInsn C.struct_bpf_insn
-
-type BpfHdr C.struct_bpf_hdr
-
-type BpfZbufHeader C.struct_bpf_zbuf_header
-
-// Terminal handling
-
-type Termios C.struct_termios
-
-type Winsize C.struct_winsize
-
-// fchmodat-like syscalls.
-
-const (
-	AT_FDCWD            = C.AT_FDCWD
-	AT_REMOVEDIR        = C.AT_REMOVEDIR
-	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
-	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
-)
-
-// poll
-
-type PollFd C.struct_pollfd
-
-const (
-	POLLERR      = C.POLLERR
-	POLLHUP      = C.POLLHUP
-	POLLIN       = C.POLLIN
-	POLLINIGNEOF = C.POLLINIGNEOF
-	POLLNVAL     = C.POLLNVAL
-	POLLOUT      = C.POLLOUT
-	POLLPRI      = C.POLLPRI
-	POLLRDBAND   = C.POLLRDBAND
-	POLLRDNORM   = C.POLLRDNORM
-	POLLWRBAND   = C.POLLWRBAND
-	POLLWRNORM   = C.POLLWRNORM
-)
-
-// Capabilities
-
-type CapRights C.struct_cap_rights
-
-// Uname
-
-type Utsname C.struct_utsname
diff --git a/vendor/golang.org/x/sys/unix/types_netbsd.go b/vendor/golang.org/x/sys/unix/types_netbsd.go
deleted file mode 100644
index 4a96d72..0000000
--- a/vendor/golang.org/x/sys/unix/types_netbsd.go
+++ /dev/null
@@ -1,290 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-Input to cgo -godefs.  See README.md
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#define KERNEL
-#include <dirent.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <signal.h>
-#include <termios.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/event.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/icmp6.h>
-#include <netinet/tcp.h>
-
-enum {
-	sizeofPtr = sizeof(void*),
-};
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-*/
-import "C"
-
-// Machine characteristics
-
-const (
-	SizeofPtr      = C.sizeofPtr
-	SizeofShort    = C.sizeof_short
-	SizeofInt      = C.sizeof_int
-	SizeofLong     = C.sizeof_long
-	SizeofLongLong = C.sizeof_longlong
-)
-
-// Basic types
-
-type (
-	_C_short     C.short
-	_C_int       C.int
-	_C_long      C.long
-	_C_long_long C.longlong
-)
-
-// Time
-
-type Timespec C.struct_timespec
-
-type Timeval C.struct_timeval
-
-// Processes
-
-type Rusage C.struct_rusage
-
-type Rlimit C.struct_rlimit
-
-type _Gid_t C.gid_t
-
-// Files
-
-type Stat_t C.struct_stat
-
-type Statfs_t C.struct_statfs
-
-type Flock_t C.struct_flock
-
-type Dirent C.struct_dirent
-
-type Fsid C.fsid_t
-
-// File system limits
-
-const (
-	PathMax = C.PATH_MAX
-)
-
-// Advice to Fadvise
-
-const (
-	FADV_NORMAL     = C.POSIX_FADV_NORMAL
-	FADV_RANDOM     = C.POSIX_FADV_RANDOM
-	FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
-	FADV_WILLNEED   = C.POSIX_FADV_WILLNEED
-	FADV_DONTNEED   = C.POSIX_FADV_DONTNEED
-	FADV_NOREUSE    = C.POSIX_FADV_NOREUSE
-)
-
-// Sockets
-
-type RawSockaddrInet4 C.struct_sockaddr_in
-
-type RawSockaddrInet6 C.struct_sockaddr_in6
-
-type RawSockaddrUnix C.struct_sockaddr_un
-
-type RawSockaddrDatalink C.struct_sockaddr_dl
-
-type RawSockaddr C.struct_sockaddr
-
-type RawSockaddrAny C.struct_sockaddr_any
-
-type _Socklen C.socklen_t
-
-type Linger C.struct_linger
-
-type Iovec C.struct_iovec
-
-type IPMreq C.struct_ip_mreq
-
-type IPv6Mreq C.struct_ipv6_mreq
-
-type Msghdr C.struct_msghdr
-
-type Cmsghdr C.struct_cmsghdr
-
-type Inet6Pktinfo C.struct_in6_pktinfo
-
-type IPv6MTUInfo C.struct_ip6_mtuinfo
-
-type ICMPv6Filter C.struct_icmp6_filter
-
-const (
-	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
-	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
-	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
-	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
-	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
-	SizeofLinger           = C.sizeof_struct_linger
-	SizeofIPMreq           = C.sizeof_struct_ip_mreq
-	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
-	SizeofMsghdr           = C.sizeof_struct_msghdr
-	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
-	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
-	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
-	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
-)
-
-// Ptrace requests
-
-const (
-	PTRACE_TRACEME = C.PT_TRACE_ME
-	PTRACE_CONT    = C.PT_CONTINUE
-	PTRACE_KILL    = C.PT_KILL
-)
-
-// Events (kqueue, kevent)
-
-type Kevent_t C.struct_kevent
-
-// Select
-
-type FdSet C.fd_set
-
-// Routing and interface messages
-
-const (
-	SizeofIfMsghdr         = C.sizeof_struct_if_msghdr
-	SizeofIfData           = C.sizeof_struct_if_data
-	SizeofIfaMsghdr        = C.sizeof_struct_ifa_msghdr
-	SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
-	SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
-	SizeofRtMetrics        = C.sizeof_struct_rt_metrics
-)
-
-type IfMsghdr C.struct_if_msghdr
-
-type IfData C.struct_if_data
-
-type IfaMsghdr C.struct_ifa_msghdr
-
-type IfAnnounceMsghdr C.struct_if_announcemsghdr
-
-type RtMsghdr C.struct_rt_msghdr
-
-type RtMetrics C.struct_rt_metrics
-
-type Mclpool C.struct_mclpool
-
-// Berkeley packet filter
-
-const (
-	SizeofBpfVersion = C.sizeof_struct_bpf_version
-	SizeofBpfStat    = C.sizeof_struct_bpf_stat
-	SizeofBpfProgram = C.sizeof_struct_bpf_program
-	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
-	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
-)
-
-type BpfVersion C.struct_bpf_version
-
-type BpfStat C.struct_bpf_stat
-
-type BpfProgram C.struct_bpf_program
-
-type BpfInsn C.struct_bpf_insn
-
-type BpfHdr C.struct_bpf_hdr
-
-type BpfTimeval C.struct_bpf_timeval
-
-// Terminal handling
-
-type Termios C.struct_termios
-
-type Winsize C.struct_winsize
-
-type Ptmget C.struct_ptmget
-
-// fchmodat-like syscalls.
-
-const (
-	AT_FDCWD            = C.AT_FDCWD
-	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
-	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
-)
-
-// poll
-
-type PollFd C.struct_pollfd
-
-const (
-	POLLERR    = C.POLLERR
-	POLLHUP    = C.POLLHUP
-	POLLIN     = C.POLLIN
-	POLLNVAL   = C.POLLNVAL
-	POLLOUT    = C.POLLOUT
-	POLLPRI    = C.POLLPRI
-	POLLRDBAND = C.POLLRDBAND
-	POLLRDNORM = C.POLLRDNORM
-	POLLWRBAND = C.POLLWRBAND
-	POLLWRNORM = C.POLLWRNORM
-)
-
-// Sysctl
-
-type Sysctlnode C.struct_sysctlnode
-
-// Uname
-
-type Utsname C.struct_utsname
-
-// Clockinfo
-
-const SizeofClockinfo = C.sizeof_struct_clockinfo
-
-type Clockinfo C.struct_clockinfo
diff --git a/vendor/golang.org/x/sys/unix/types_openbsd.go b/vendor/golang.org/x/sys/unix/types_openbsd.go
deleted file mode 100644
index 775cb57..0000000
--- a/vendor/golang.org/x/sys/unix/types_openbsd.go
+++ /dev/null
@@ -1,283 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-Input to cgo -godefs.  See README.md
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#define KERNEL
-#include <dirent.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <signal.h>
-#include <termios.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/event.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <uvm/uvmexp.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/icmp6.h>
-#include <netinet/tcp.h>
-
-enum {
-	sizeofPtr = sizeof(void*),
-};
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-*/
-import "C"
-
-// Machine characteristics
-
-const (
-	SizeofPtr      = C.sizeofPtr
-	SizeofShort    = C.sizeof_short
-	SizeofInt      = C.sizeof_int
-	SizeofLong     = C.sizeof_long
-	SizeofLongLong = C.sizeof_longlong
-)
-
-// Basic types
-
-type (
-	_C_short     C.short
-	_C_int       C.int
-	_C_long      C.long
-	_C_long_long C.longlong
-)
-
-// Time
-
-type Timespec C.struct_timespec
-
-type Timeval C.struct_timeval
-
-// Processes
-
-type Rusage C.struct_rusage
-
-type Rlimit C.struct_rlimit
-
-type _Gid_t C.gid_t
-
-// Files
-
-type Stat_t C.struct_stat
-
-type Statfs_t C.struct_statfs
-
-type Flock_t C.struct_flock
-
-type Dirent C.struct_dirent
-
-type Fsid C.fsid_t
-
-// File system limits
-
-const (
-	PathMax = C.PATH_MAX
-)
-
-// Sockets
-
-type RawSockaddrInet4 C.struct_sockaddr_in
-
-type RawSockaddrInet6 C.struct_sockaddr_in6
-
-type RawSockaddrUnix C.struct_sockaddr_un
-
-type RawSockaddrDatalink C.struct_sockaddr_dl
-
-type RawSockaddr C.struct_sockaddr
-
-type RawSockaddrAny C.struct_sockaddr_any
-
-type _Socklen C.socklen_t
-
-type Linger C.struct_linger
-
-type Iovec C.struct_iovec
-
-type IPMreq C.struct_ip_mreq
-
-type IPv6Mreq C.struct_ipv6_mreq
-
-type Msghdr C.struct_msghdr
-
-type Cmsghdr C.struct_cmsghdr
-
-type Inet6Pktinfo C.struct_in6_pktinfo
-
-type IPv6MTUInfo C.struct_ip6_mtuinfo
-
-type ICMPv6Filter C.struct_icmp6_filter
-
-const (
-	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
-	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
-	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
-	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
-	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
-	SizeofLinger           = C.sizeof_struct_linger
-	SizeofIPMreq           = C.sizeof_struct_ip_mreq
-	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
-	SizeofMsghdr           = C.sizeof_struct_msghdr
-	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
-	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
-	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
-	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
-)
-
-// Ptrace requests
-
-const (
-	PTRACE_TRACEME = C.PT_TRACE_ME
-	PTRACE_CONT    = C.PT_CONTINUE
-	PTRACE_KILL    = C.PT_KILL
-)
-
-// Events (kqueue, kevent)
-
-type Kevent_t C.struct_kevent
-
-// Select
-
-type FdSet C.fd_set
-
-// Routing and interface messages
-
-const (
-	SizeofIfMsghdr         = C.sizeof_struct_if_msghdr
-	SizeofIfData           = C.sizeof_struct_if_data
-	SizeofIfaMsghdr        = C.sizeof_struct_ifa_msghdr
-	SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr
-	SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
-	SizeofRtMetrics        = C.sizeof_struct_rt_metrics
-)
-
-type IfMsghdr C.struct_if_msghdr
-
-type IfData C.struct_if_data
-
-type IfaMsghdr C.struct_ifa_msghdr
-
-type IfAnnounceMsghdr C.struct_if_announcemsghdr
-
-type RtMsghdr C.struct_rt_msghdr
-
-type RtMetrics C.struct_rt_metrics
-
-type Mclpool C.struct_mclpool
-
-// Berkeley packet filter
-
-const (
-	SizeofBpfVersion = C.sizeof_struct_bpf_version
-	SizeofBpfStat    = C.sizeof_struct_bpf_stat
-	SizeofBpfProgram = C.sizeof_struct_bpf_program
-	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
-	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
-)
-
-type BpfVersion C.struct_bpf_version
-
-type BpfStat C.struct_bpf_stat
-
-type BpfProgram C.struct_bpf_program
-
-type BpfInsn C.struct_bpf_insn
-
-type BpfHdr C.struct_bpf_hdr
-
-type BpfTimeval C.struct_bpf_timeval
-
-// Terminal handling
-
-type Termios C.struct_termios
-
-type Winsize C.struct_winsize
-
-// fchmodat-like syscalls.
-
-const (
-	AT_FDCWD            = C.AT_FDCWD
-	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
-	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
-)
-
-// poll
-
-type PollFd C.struct_pollfd
-
-const (
-	POLLERR    = C.POLLERR
-	POLLHUP    = C.POLLHUP
-	POLLIN     = C.POLLIN
-	POLLNVAL   = C.POLLNVAL
-	POLLOUT    = C.POLLOUT
-	POLLPRI    = C.POLLPRI
-	POLLRDBAND = C.POLLRDBAND
-	POLLRDNORM = C.POLLRDNORM
-	POLLWRBAND = C.POLLWRBAND
-	POLLWRNORM = C.POLLWRNORM
-)
-
-// Signal Sets
-
-type Sigset_t C.sigset_t
-
-// Uname
-
-type Utsname C.struct_utsname
-
-// Uvmexp
-
-const SizeofUvmexp = C.sizeof_struct_uvmexp
-
-type Uvmexp C.struct_uvmexp
-
-// Clockinfo
-
-const SizeofClockinfo = C.sizeof_struct_clockinfo
-
-type Clockinfo C.struct_clockinfo
diff --git a/vendor/golang.org/x/sys/unix/types_solaris.go b/vendor/golang.org/x/sys/unix/types_solaris.go
deleted file mode 100644
index 2b716f9..0000000
--- a/vendor/golang.org/x/sys/unix/types_solaris.go
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-Input to cgo -godefs.  See README.md
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#define KERNEL
-// These defines ensure that builds done on newer versions of Solaris are
-// backwards-compatible with older versions of Solaris and
-// OpenSolaris-based derivatives.
-#define __USE_SUNOS_SOCKETS__          // msghdr
-#define __USE_LEGACY_PROTOTYPES__      // iovec
-#include <dirent.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <poll.h>
-#include <signal.h>
-#include <termios.h>
-#include <termio.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/statvfs.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/un.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/icmp6.h>
-#include <netinet/tcp.h>
-#include <ustat.h>
-#include <utime.h>
-
-enum {
-	sizeofPtr = sizeof(void*),
-};
-
-union sockaddr_all {
-	struct sockaddr s1;	// this one gets used for fields
-	struct sockaddr_in s2;	// these pad it out
-	struct sockaddr_in6 s3;
-	struct sockaddr_un s4;
-	struct sockaddr_dl s5;
-};
-
-struct sockaddr_any {
-	struct sockaddr addr;
-	char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-*/
-import "C"
-
-// Machine characteristics
-
-const (
-	SizeofPtr      = C.sizeofPtr
-	SizeofShort    = C.sizeof_short
-	SizeofInt      = C.sizeof_int
-	SizeofLong     = C.sizeof_long
-	SizeofLongLong = C.sizeof_longlong
-	PathMax        = C.PATH_MAX
-	MaxHostNameLen = C.MAXHOSTNAMELEN
-)
-
-// Basic types
-
-type (
-	_C_short     C.short
-	_C_int       C.int
-	_C_long      C.long
-	_C_long_long C.longlong
-)
-
-// Time
-
-type Timespec C.struct_timespec
-
-type Timeval C.struct_timeval
-
-type Timeval32 C.struct_timeval32
-
-type Tms C.struct_tms
-
-type Utimbuf C.struct_utimbuf
-
-// Processes
-
-type Rusage C.struct_rusage
-
-type Rlimit C.struct_rlimit
-
-type _Gid_t C.gid_t
-
-// Files
-
-type Stat_t C.struct_stat
-
-type Flock_t C.struct_flock
-
-type Dirent C.struct_dirent
-
-// Filesystems
-
-type _Fsblkcnt_t C.fsblkcnt_t
-
-type Statvfs_t C.struct_statvfs
-
-// Sockets
-
-type RawSockaddrInet4 C.struct_sockaddr_in
-
-type RawSockaddrInet6 C.struct_sockaddr_in6
-
-type RawSockaddrUnix C.struct_sockaddr_un
-
-type RawSockaddrDatalink C.struct_sockaddr_dl
-
-type RawSockaddr C.struct_sockaddr
-
-type RawSockaddrAny C.struct_sockaddr_any
-
-type _Socklen C.socklen_t
-
-type Linger C.struct_linger
-
-type Iovec C.struct_iovec
-
-type IPMreq C.struct_ip_mreq
-
-type IPv6Mreq C.struct_ipv6_mreq
-
-type Msghdr C.struct_msghdr
-
-type Cmsghdr C.struct_cmsghdr
-
-type Inet6Pktinfo C.struct_in6_pktinfo
-
-type IPv6MTUInfo C.struct_ip6_mtuinfo
-
-type ICMPv6Filter C.struct_icmp6_filter
-
-const (
-	SizeofSockaddrInet4    = C.sizeof_struct_sockaddr_in
-	SizeofSockaddrInet6    = C.sizeof_struct_sockaddr_in6
-	SizeofSockaddrAny      = C.sizeof_struct_sockaddr_any
-	SizeofSockaddrUnix     = C.sizeof_struct_sockaddr_un
-	SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
-	SizeofLinger           = C.sizeof_struct_linger
-	SizeofIPMreq           = C.sizeof_struct_ip_mreq
-	SizeofIPv6Mreq         = C.sizeof_struct_ipv6_mreq
-	SizeofMsghdr           = C.sizeof_struct_msghdr
-	SizeofCmsghdr          = C.sizeof_struct_cmsghdr
-	SizeofInet6Pktinfo     = C.sizeof_struct_in6_pktinfo
-	SizeofIPv6MTUInfo      = C.sizeof_struct_ip6_mtuinfo
-	SizeofICMPv6Filter     = C.sizeof_struct_icmp6_filter
-)
-
-// Select
-
-type FdSet C.fd_set
-
-// Misc
-
-type Utsname C.struct_utsname
-
-type Ustat_t C.struct_ustat
-
-const (
-	AT_FDCWD            = C.AT_FDCWD
-	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
-	AT_SYMLINK_FOLLOW   = C.AT_SYMLINK_FOLLOW
-	AT_REMOVEDIR        = C.AT_REMOVEDIR
-	AT_EACCESS          = C.AT_EACCESS
-)
-
-// Routing and interface messages
-
-const (
-	SizeofIfMsghdr  = C.sizeof_struct_if_msghdr
-	SizeofIfData    = C.sizeof_struct_if_data
-	SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr
-	SizeofRtMsghdr  = C.sizeof_struct_rt_msghdr
-	SizeofRtMetrics = C.sizeof_struct_rt_metrics
-)
-
-type IfMsghdr C.struct_if_msghdr
-
-type IfData C.struct_if_data
-
-type IfaMsghdr C.struct_ifa_msghdr
-
-type RtMsghdr C.struct_rt_msghdr
-
-type RtMetrics C.struct_rt_metrics
-
-// Berkeley packet filter
-
-const (
-	SizeofBpfVersion = C.sizeof_struct_bpf_version
-	SizeofBpfStat    = C.sizeof_struct_bpf_stat
-	SizeofBpfProgram = C.sizeof_struct_bpf_program
-	SizeofBpfInsn    = C.sizeof_struct_bpf_insn
-	SizeofBpfHdr     = C.sizeof_struct_bpf_hdr
-)
-
-type BpfVersion C.struct_bpf_version
-
-type BpfStat C.struct_bpf_stat
-
-type BpfProgram C.struct_bpf_program
-
-type BpfInsn C.struct_bpf_insn
-
-type BpfTimeval C.struct_bpf_timeval
-
-type BpfHdr C.struct_bpf_hdr
-
-// Terminal handling
-
-type Termios C.struct_termios
-
-type Termio C.struct_termio
-
-type Winsize C.struct_winsize
-
-// poll
-
-type PollFd C.struct_pollfd
-
-const (
-	POLLERR    = C.POLLERR
-	POLLHUP    = C.POLLHUP
-	POLLIN     = C.POLLIN
-	POLLNVAL   = C.POLLNVAL
-	POLLOUT    = C.POLLOUT
-	POLLPRI    = C.POLLPRI
-	POLLRDBAND = C.POLLRDBAND
-	POLLRDNORM = C.POLLRDNORM
-	POLLWRBAND = C.POLLWRBAND
-	POLLWRNORM = C.POLLWRNORM
-)
diff --git a/vendor/golang.org/x/text/unicode/bidi/gen.go b/vendor/golang.org/x/text/unicode/bidi/gen.go
deleted file mode 100644
index 987fc16..0000000
--- a/vendor/golang.org/x/text/unicode/bidi/gen.go
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"flag"
-	"log"
-
-	"golang.org/x/text/internal/gen"
-	"golang.org/x/text/internal/triegen"
-	"golang.org/x/text/internal/ucd"
-)
-
-var outputFile = flag.String("out", "tables.go", "output file")
-
-func main() {
-	gen.Init()
-	gen.Repackage("gen_trieval.go", "trieval.go", "bidi")
-	gen.Repackage("gen_ranges.go", "ranges_test.go", "bidi")
-
-	genTables()
-}
-
-// bidiClass names and codes taken from class "bc" in
-// https://www.unicode.org/Public/8.0.0/ucd/PropertyValueAliases.txt
-var bidiClass = map[string]Class{
-	"AL":  AL,  // ArabicLetter
-	"AN":  AN,  // ArabicNumber
-	"B":   B,   // ParagraphSeparator
-	"BN":  BN,  // BoundaryNeutral
-	"CS":  CS,  // CommonSeparator
-	"EN":  EN,  // EuropeanNumber
-	"ES":  ES,  // EuropeanSeparator
-	"ET":  ET,  // EuropeanTerminator
-	"L":   L,   // LeftToRight
-	"NSM": NSM, // NonspacingMark
-	"ON":  ON,  // OtherNeutral
-	"R":   R,   // RightToLeft
-	"S":   S,   // SegmentSeparator
-	"WS":  WS,  // WhiteSpace
-
-	"FSI": Control,
-	"PDF": Control,
-	"PDI": Control,
-	"LRE": Control,
-	"LRI": Control,
-	"LRO": Control,
-	"RLE": Control,
-	"RLI": Control,
-	"RLO": Control,
-}
-
-func genTables() {
-	if numClass > 0x0F {
-		log.Fatalf("Too many Class constants (%#x > 0x0F).", numClass)
-	}
-	w := gen.NewCodeWriter()
-	defer w.WriteVersionedGoFile(*outputFile, "bidi")
-
-	gen.WriteUnicodeVersion(w)
-
-	t := triegen.NewTrie("bidi")
-
-	// Build data about bracket mapping. These bits need to be or-ed with
-	// any other bits.
-	orMask := map[rune]uint64{}
-
-	xorMap := map[rune]int{}
-	xorMasks := []rune{0} // First value is no-op.
-
-	ucd.Parse(gen.OpenUCDFile("BidiBrackets.txt"), func(p *ucd.Parser) {
-		r1 := p.Rune(0)
-		r2 := p.Rune(1)
-		xor := r1 ^ r2
-		if _, ok := xorMap[xor]; !ok {
-			xorMap[xor] = len(xorMasks)
-			xorMasks = append(xorMasks, xor)
-		}
-		entry := uint64(xorMap[xor]) << xorMaskShift
-		switch p.String(2) {
-		case "o":
-			entry |= openMask
-		case "c", "n":
-		default:
-			log.Fatalf("Unknown bracket class %q.", p.String(2))
-		}
-		orMask[r1] = entry
-	})
-
-	w.WriteComment(`
-	xorMasks contains masks to be xor-ed with brackets to get the reverse
-	version.`)
-	w.WriteVar("xorMasks", xorMasks)
-
-	done := map[rune]bool{}
-
-	insert := func(r rune, c Class) {
-		if !done[r] {
-			t.Insert(r, orMask[r]|uint64(c))
-			done[r] = true
-		}
-	}
-
-	// Insert the derived BiDi properties.
-	ucd.Parse(gen.OpenUCDFile("extracted/DerivedBidiClass.txt"), func(p *ucd.Parser) {
-		r := p.Rune(0)
-		class, ok := bidiClass[p.String(1)]
-		if !ok {
-			log.Fatalf("%U: Unknown BiDi class %q", r, p.String(1))
-		}
-		insert(r, class)
-	})
-	visitDefaults(insert)
-
-	// TODO: use sparse blocks. This would reduce table size considerably
-	// from the looks of it.
-
-	sz, err := t.Gen(w)
-	if err != nil {
-		log.Fatal(err)
-	}
-	w.Size += sz
-}
-
-// dummy values to make methods in gen_common compile. The real versions
-// will be generated by this file to tables.go.
-var (
-	xorMasks []rune
-)
diff --git a/vendor/golang.org/x/text/unicode/bidi/gen_ranges.go b/vendor/golang.org/x/text/unicode/bidi/gen_ranges.go
deleted file mode 100644
index 02c3b50..0000000
--- a/vendor/golang.org/x/text/unicode/bidi/gen_ranges.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"unicode"
-
-	"golang.org/x/text/internal/gen"
-	"golang.org/x/text/internal/ucd"
-	"golang.org/x/text/unicode/rangetable"
-)
-
-// These tables are hand-extracted from:
-// https://www.unicode.org/Public/8.0.0/ucd/extracted/DerivedBidiClass.txt
-func visitDefaults(fn func(r rune, c Class)) {
-	// first write default values for ranges listed above.
-	visitRunes(fn, AL, []rune{
-		0x0600, 0x07BF, // Arabic
-		0x08A0, 0x08FF, // Arabic Extended-A
-		0xFB50, 0xFDCF, // Arabic Presentation Forms
-		0xFDF0, 0xFDFF,
-		0xFE70, 0xFEFF,
-		0x0001EE00, 0x0001EEFF, // Arabic Mathematical Alpha Symbols
-	})
-	visitRunes(fn, R, []rune{
-		0x0590, 0x05FF, // Hebrew
-		0x07C0, 0x089F, // Nko et al.
-		0xFB1D, 0xFB4F,
-		0x00010800, 0x00010FFF, // Cypriot Syllabary et. al.
-		0x0001E800, 0x0001EDFF,
-		0x0001EF00, 0x0001EFFF,
-	})
-	visitRunes(fn, ET, []rune{ // European Terminator
-		0x20A0, 0x20Cf, // Currency symbols
-	})
-	rangetable.Visit(unicode.Noncharacter_Code_Point, func(r rune) {
-		fn(r, BN) // Boundary Neutral
-	})
-	ucd.Parse(gen.OpenUCDFile("DerivedCoreProperties.txt"), func(p *ucd.Parser) {
-		if p.String(1) == "Default_Ignorable_Code_Point" {
-			fn(p.Rune(0), BN) // Boundary Neutral
-		}
-	})
-}
-
-func visitRunes(fn func(r rune, c Class), c Class, runes []rune) {
-	for i := 0; i < len(runes); i += 2 {
-		lo, hi := runes[i], runes[i+1]
-		for j := lo; j <= hi; j++ {
-			fn(j, c)
-		}
-	}
-}
diff --git a/vendor/golang.org/x/text/unicode/bidi/gen_trieval.go b/vendor/golang.org/x/text/unicode/bidi/gen_trieval.go
deleted file mode 100644
index 9cb9942..0000000
--- a/vendor/golang.org/x/text/unicode/bidi/gen_trieval.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-// Class is the Unicode BiDi class. Each rune has a single class.
-type Class uint
-
-const (
-	L       Class = iota // LeftToRight
-	R                    // RightToLeft
-	EN                   // EuropeanNumber
-	ES                   // EuropeanSeparator
-	ET                   // EuropeanTerminator
-	AN                   // ArabicNumber
-	CS                   // CommonSeparator
-	B                    // ParagraphSeparator
-	S                    // SegmentSeparator
-	WS                   // WhiteSpace
-	ON                   // OtherNeutral
-	BN                   // BoundaryNeutral
-	NSM                  // NonspacingMark
-	AL                   // ArabicLetter
-	Control              // Control LRO - PDI
-
-	numClass
-
-	LRO // LeftToRightOverride
-	RLO // RightToLeftOverride
-	LRE // LeftToRightEmbedding
-	RLE // RightToLeftEmbedding
-	PDF // PopDirectionalFormat
-	LRI // LeftToRightIsolate
-	RLI // RightToLeftIsolate
-	FSI // FirstStrongIsolate
-	PDI // PopDirectionalIsolate
-
-	unknownClass = ^Class(0)
-)
-
-var controlToClass = map[rune]Class{
-	0x202D: LRO, // LeftToRightOverride,
-	0x202E: RLO, // RightToLeftOverride,
-	0x202A: LRE, // LeftToRightEmbedding,
-	0x202B: RLE, // RightToLeftEmbedding,
-	0x202C: PDF, // PopDirectionalFormat,
-	0x2066: LRI, // LeftToRightIsolate,
-	0x2067: RLI, // RightToLeftIsolate,
-	0x2068: FSI, // FirstStrongIsolate,
-	0x2069: PDI, // PopDirectionalIsolate,
-}
-
-// A trie entry has the following bits:
-// 7..5  XOR mask for brackets
-// 4     1: Bracket open, 0: Bracket close
-// 3..0  Class type
-
-const (
-	openMask     = 0x10
-	xorMaskShift = 5
-)
diff --git a/vendor/golang.org/x/text/unicode/norm/maketables.go b/vendor/golang.org/x/text/unicode/norm/maketables.go
deleted file mode 100644
index 30a3aa9..0000000
--- a/vendor/golang.org/x/text/unicode/norm/maketables.go
+++ /dev/null
@@ -1,986 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-// Normalization table generator.
-// Data read from the web.
-// See forminfo.go for a description of the trie values associated with each rune.
-
-package main
-
-import (
-	"bytes"
-	"encoding/binary"
-	"flag"
-	"fmt"
-	"io"
-	"log"
-	"sort"
-	"strconv"
-	"strings"
-
-	"golang.org/x/text/internal/gen"
-	"golang.org/x/text/internal/triegen"
-	"golang.org/x/text/internal/ucd"
-)
-
-func main() {
-	gen.Init()
-	loadUnicodeData()
-	compactCCC()
-	loadCompositionExclusions()
-	completeCharFields(FCanonical)
-	completeCharFields(FCompatibility)
-	computeNonStarterCounts()
-	verifyComputed()
-	printChars()
-	testDerived()
-	printTestdata()
-	makeTables()
-}
-
-var (
-	tablelist = flag.String("tables",
-		"all",
-		"comma-separated list of which tables to generate; "+
-			"can be 'decomp', 'recomp', 'info' and 'all'")
-	test = flag.Bool("test",
-		false,
-		"test existing tables against DerivedNormalizationProps and generate test data for regression testing")
-	verbose = flag.Bool("verbose",
-		false,
-		"write data to stdout as it is parsed")
-)
-
-const MaxChar = 0x10FFFF // anything above this shouldn't exist
-
-// Quick Check properties of runes allow us to quickly
-// determine whether a rune may occur in a normal form.
-// For a given normal form, a rune may be guaranteed to occur
-// verbatim (QC=Yes), may or may not combine with another
-// rune (QC=Maybe), or may not occur (QC=No).
-type QCResult int
-
-const (
-	QCUnknown QCResult = iota
-	QCYes
-	QCNo
-	QCMaybe
-)
-
-func (r QCResult) String() string {
-	switch r {
-	case QCYes:
-		return "Yes"
-	case QCNo:
-		return "No"
-	case QCMaybe:
-		return "Maybe"
-	}
-	return "***UNKNOWN***"
-}
-
-const (
-	FCanonical     = iota // NFC or NFD
-	FCompatibility        // NFKC or NFKD
-	FNumberOfFormTypes
-)
-
-const (
-	MComposed   = iota // NFC or NFKC
-	MDecomposed        // NFD or NFKD
-	MNumberOfModes
-)
-
-// This contains only the properties we're interested in.
-type Char struct {
-	name          string
-	codePoint     rune  // if zero, this index is not a valid code point.
-	ccc           uint8 // canonical combining class
-	origCCC       uint8
-	excludeInComp bool // from CompositionExclusions.txt
-	compatDecomp  bool // it has a compatibility expansion
-
-	nTrailingNonStarters uint8
-	nLeadingNonStarters  uint8 // must be equal to trailing if non-zero
-
-	forms [FNumberOfFormTypes]FormInfo // For FCanonical and FCompatibility
-
-	state State
-}
-
-var chars = make([]Char, MaxChar+1)
-var cccMap = make(map[uint8]uint8)
-
-func (c Char) String() string {
-	buf := new(bytes.Buffer)
-
-	fmt.Fprintf(buf, "%U [%s]:\n", c.codePoint, c.name)
-	fmt.Fprintf(buf, "  ccc: %v\n", c.ccc)
-	fmt.Fprintf(buf, "  excludeInComp: %v\n", c.excludeInComp)
-	fmt.Fprintf(buf, "  compatDecomp: %v\n", c.compatDecomp)
-	fmt.Fprintf(buf, "  state: %v\n", c.state)
-	fmt.Fprintf(buf, "  NFC:\n")
-	fmt.Fprint(buf, c.forms[FCanonical])
-	fmt.Fprintf(buf, "  NFKC:\n")
-	fmt.Fprint(buf, c.forms[FCompatibility])
-
-	return buf.String()
-}
-
-// In UnicodeData.txt, some ranges are marked like this:
-//	3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
-//	4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
-// parseCharacter keeps a state variable indicating the weirdness.
-type State int
-
-const (
-	SNormal State = iota // known to be zero for the type
-	SFirst
-	SLast
-	SMissing
-)
-
-var lastChar = rune('\u0000')
-
-func (c Char) isValid() bool {
-	return c.codePoint != 0 && c.state != SMissing
-}
-
-type FormInfo struct {
-	quickCheck [MNumberOfModes]QCResult // index: MComposed or MDecomposed
-	verified   [MNumberOfModes]bool     // index: MComposed or MDecomposed
-
-	combinesForward  bool // May combine with rune on the right
-	combinesBackward bool // May combine with rune on the left
-	isOneWay         bool // Never appears in result
-	inDecomp         bool // Some decompositions result in this char.
-	decomp           Decomposition
-	expandedDecomp   Decomposition
-}
-
-func (f FormInfo) String() string {
-	buf := bytes.NewBuffer(make([]byte, 0))
-
-	fmt.Fprintf(buf, "    quickCheck[C]: %v\n", f.quickCheck[MComposed])
-	fmt.Fprintf(buf, "    quickCheck[D]: %v\n", f.quickCheck[MDecomposed])
-	fmt.Fprintf(buf, "    cmbForward: %v\n", f.combinesForward)
-	fmt.Fprintf(buf, "    cmbBackward: %v\n", f.combinesBackward)
-	fmt.Fprintf(buf, "    isOneWay: %v\n", f.isOneWay)
-	fmt.Fprintf(buf, "    inDecomp: %v\n", f.inDecomp)
-	fmt.Fprintf(buf, "    decomposition: %X\n", f.decomp)
-	fmt.Fprintf(buf, "    expandedDecomp: %X\n", f.expandedDecomp)
-
-	return buf.String()
-}
-
-type Decomposition []rune
-
-func parseDecomposition(s string, skipfirst bool) (a []rune, err error) {
-	decomp := strings.Split(s, " ")
-	if len(decomp) > 0 && skipfirst {
-		decomp = decomp[1:]
-	}
-	for _, d := range decomp {
-		point, err := strconv.ParseUint(d, 16, 64)
-		if err != nil {
-			return a, err
-		}
-		a = append(a, rune(point))
-	}
-	return a, nil
-}
-
-func loadUnicodeData() {
-	f := gen.OpenUCDFile("UnicodeData.txt")
-	defer f.Close()
-	p := ucd.New(f)
-	for p.Next() {
-		r := p.Rune(ucd.CodePoint)
-		char := &chars[r]
-
-		char.ccc = uint8(p.Uint(ucd.CanonicalCombiningClass))
-		decmap := p.String(ucd.DecompMapping)
-
-		exp, err := parseDecomposition(decmap, false)
-		isCompat := false
-		if err != nil {
-			if len(decmap) > 0 {
-				exp, err = parseDecomposition(decmap, true)
-				if err != nil {
-					log.Fatalf(`%U: bad decomp |%v|: "%s"`, r, decmap, err)
-				}
-				isCompat = true
-			}
-		}
-
-		char.name = p.String(ucd.Name)
-		char.codePoint = r
-		char.forms[FCompatibility].decomp = exp
-		if !isCompat {
-			char.forms[FCanonical].decomp = exp
-		} else {
-			char.compatDecomp = true
-		}
-		if len(decmap) > 0 {
-			char.forms[FCompatibility].decomp = exp
-		}
-	}
-	if err := p.Err(); err != nil {
-		log.Fatal(err)
-	}
-}
-
-// compactCCC converts the sparse set of CCC values to a continguous one,
-// reducing the number of bits needed from 8 to 6.
-func compactCCC() {
-	m := make(map[uint8]uint8)
-	for i := range chars {
-		c := &chars[i]
-		m[c.ccc] = 0
-	}
-	cccs := []int{}
-	for v, _ := range m {
-		cccs = append(cccs, int(v))
-	}
-	sort.Ints(cccs)
-	for i, c := range cccs {
-		cccMap[uint8(i)] = uint8(c)
-		m[uint8(c)] = uint8(i)
-	}
-	for i := range chars {
-		c := &chars[i]
-		c.origCCC = c.ccc
-		c.ccc = m[c.ccc]
-	}
-	if len(m) >= 1<<6 {
-		log.Fatalf("too many difference CCC values: %d >= 64", len(m))
-	}
-}
-
-// CompositionExclusions.txt has form:
-// 0958    # ...
-// See https://unicode.org/reports/tr44/ for full explanation
-func loadCompositionExclusions() {
-	f := gen.OpenUCDFile("CompositionExclusions.txt")
-	defer f.Close()
-	p := ucd.New(f)
-	for p.Next() {
-		c := &chars[p.Rune(0)]
-		if c.excludeInComp {
-			log.Fatalf("%U: Duplicate entry in exclusions.", c.codePoint)
-		}
-		c.excludeInComp = true
-	}
-	if e := p.Err(); e != nil {
-		log.Fatal(e)
-	}
-}
-
-// hasCompatDecomp returns true if any of the recursive
-// decompositions contains a compatibility expansion.
-// In this case, the character may not occur in NFK*.
-func hasCompatDecomp(r rune) bool {
-	c := &chars[r]
-	if c.compatDecomp {
-		return true
-	}
-	for _, d := range c.forms[FCompatibility].decomp {
-		if hasCompatDecomp(d) {
-			return true
-		}
-	}
-	return false
-}
-
-// Hangul related constants.
-const (
-	HangulBase = 0xAC00
-	HangulEnd  = 0xD7A4 // hangulBase + Jamo combinations (19 * 21 * 28)
-
-	JamoLBase = 0x1100
-	JamoLEnd  = 0x1113
-	JamoVBase = 0x1161
-	JamoVEnd  = 0x1176
-	JamoTBase = 0x11A8
-	JamoTEnd  = 0x11C3
-
-	JamoLVTCount = 19 * 21 * 28
-	JamoTCount   = 28
-)
-
-func isHangul(r rune) bool {
-	return HangulBase <= r && r < HangulEnd
-}
-
-func isHangulWithoutJamoT(r rune) bool {
-	if !isHangul(r) {
-		return false
-	}
-	r -= HangulBase
-	return r < JamoLVTCount && r%JamoTCount == 0
-}
-
-func ccc(r rune) uint8 {
-	return chars[r].ccc
-}
-
-// Insert a rune in a buffer, ordered by Canonical Combining Class.
-func insertOrdered(b Decomposition, r rune) Decomposition {
-	n := len(b)
-	b = append(b, 0)
-	cc := ccc(r)
-	if cc > 0 {
-		// Use bubble sort.
-		for ; n > 0; n-- {
-			if ccc(b[n-1]) <= cc {
-				break
-			}
-			b[n] = b[n-1]
-		}
-	}
-	b[n] = r
-	return b
-}
-
-// Recursively decompose.
-func decomposeRecursive(form int, r rune, d Decomposition) Decomposition {
-	dcomp := chars[r].forms[form].decomp
-	if len(dcomp) == 0 {
-		return insertOrdered(d, r)
-	}
-	for _, c := range dcomp {
-		d = decomposeRecursive(form, c, d)
-	}
-	return d
-}
-
-func completeCharFields(form int) {
-	// Phase 0: pre-expand decomposition.
-	for i := range chars {
-		f := &chars[i].forms[form]
-		if len(f.decomp) == 0 {
-			continue
-		}
-		exp := make(Decomposition, 0)
-		for _, c := range f.decomp {
-			exp = decomposeRecursive(form, c, exp)
-		}
-		f.expandedDecomp = exp
-	}
-
-	// Phase 1: composition exclusion, mark decomposition.
-	for i := range chars {
-		c := &chars[i]
-		f := &c.forms[form]
-
-		// Marks script-specific exclusions and version restricted.
-		f.isOneWay = c.excludeInComp
-
-		// Singletons
-		f.isOneWay = f.isOneWay || len(f.decomp) == 1
-
-		// Non-starter decompositions
-		if len(f.decomp) > 1 {
-			chk := c.ccc != 0 || chars[f.decomp[0]].ccc != 0
-			f.isOneWay = f.isOneWay || chk
-		}
-
-		// Runes that decompose into more than two runes.
-		f.isOneWay = f.isOneWay || len(f.decomp) > 2
-
-		if form == FCompatibility {
-			f.isOneWay = f.isOneWay || hasCompatDecomp(c.codePoint)
-		}
-
-		for _, r := range f.decomp {
-			chars[r].forms[form].inDecomp = true
-		}
-	}
-
-	// Phase 2: forward and backward combining.
-	for i := range chars {
-		c := &chars[i]
-		f := &c.forms[form]
-
-		if !f.isOneWay && len(f.decomp) == 2 {
-			f0 := &chars[f.decomp[0]].forms[form]
-			f1 := &chars[f.decomp[1]].forms[form]
-			if !f0.isOneWay {
-				f0.combinesForward = true
-			}
-			if !f1.isOneWay {
-				f1.combinesBackward = true
-			}
-		}
-		if isHangulWithoutJamoT(rune(i)) {
-			f.combinesForward = true
-		}
-	}
-
-	// Phase 3: quick check values.
-	for i := range chars {
-		c := &chars[i]
-		f := &c.forms[form]
-
-		switch {
-		case len(f.decomp) > 0:
-			f.quickCheck[MDecomposed] = QCNo
-		case isHangul(rune(i)):
-			f.quickCheck[MDecomposed] = QCNo
-		default:
-			f.quickCheck[MDecomposed] = QCYes
-		}
-		switch {
-		case f.isOneWay:
-			f.quickCheck[MComposed] = QCNo
-		case (i & 0xffff00) == JamoLBase:
-			f.quickCheck[MComposed] = QCYes
-			if JamoLBase <= i && i < JamoLEnd {
-				f.combinesForward = true
-			}
-			if JamoVBase <= i && i < JamoVEnd {
-				f.quickCheck[MComposed] = QCMaybe
-				f.combinesBackward = true
-				f.combinesForward = true
-			}
-			if JamoTBase <= i && i < JamoTEnd {
-				f.quickCheck[MComposed] = QCMaybe
-				f.combinesBackward = true
-			}
-		case !f.combinesBackward:
-			f.quickCheck[MComposed] = QCYes
-		default:
-			f.quickCheck[MComposed] = QCMaybe
-		}
-	}
-}
-
-func computeNonStarterCounts() {
-	// Phase 4: leading and trailing non-starter count
-	for i := range chars {
-		c := &chars[i]
-
-		runes := []rune{rune(i)}
-		// We always use FCompatibility so that the CGJ insertion points do not
-		// change for repeated normalizations with different forms.
-		if exp := c.forms[FCompatibility].expandedDecomp; len(exp) > 0 {
-			runes = exp
-		}
-		// We consider runes that combine backwards to be non-starters for the
-		// purpose of Stream-Safe Text Processing.
-		for _, r := range runes {
-			if cr := &chars[r]; cr.ccc == 0 && !cr.forms[FCompatibility].combinesBackward {
-				break
-			}
-			c.nLeadingNonStarters++
-		}
-		for i := len(runes) - 1; i >= 0; i-- {
-			if cr := &chars[runes[i]]; cr.ccc == 0 && !cr.forms[FCompatibility].combinesBackward {
-				break
-			}
-			c.nTrailingNonStarters++
-		}
-		if c.nTrailingNonStarters > 3 {
-			log.Fatalf("%U: Decomposition with more than 3 (%d) trailing modifiers (%U)", i, c.nTrailingNonStarters, runes)
-		}
-
-		if isHangul(rune(i)) {
-			c.nTrailingNonStarters = 2
-			if isHangulWithoutJamoT(rune(i)) {
-				c.nTrailingNonStarters = 1
-			}
-		}
-
-		if l, t := c.nLeadingNonStarters, c.nTrailingNonStarters; l > 0 && l != t {
-			log.Fatalf("%U: number of leading and trailing non-starters should be equal (%d vs %d)", i, l, t)
-		}
-		if t := c.nTrailingNonStarters; t > 3 {
-			log.Fatalf("%U: number of trailing non-starters is %d > 3", t)
-		}
-	}
-}
-
-func printBytes(w io.Writer, b []byte, name string) {
-	fmt.Fprintf(w, "// %s: %d bytes\n", name, len(b))
-	fmt.Fprintf(w, "var %s = [...]byte {", name)
-	for i, c := range b {
-		switch {
-		case i%64 == 0:
-			fmt.Fprintf(w, "\n// Bytes %x - %x\n", i, i+63)
-		case i%8 == 0:
-			fmt.Fprintf(w, "\n")
-		}
-		fmt.Fprintf(w, "0x%.2X, ", c)
-	}
-	fmt.Fprint(w, "\n}\n\n")
-}
-
-// See forminfo.go for format.
-func makeEntry(f *FormInfo, c *Char) uint16 {
-	e := uint16(0)
-	if r := c.codePoint; HangulBase <= r && r < HangulEnd {
-		e |= 0x40
-	}
-	if f.combinesForward {
-		e |= 0x20
-	}
-	if f.quickCheck[MDecomposed] == QCNo {
-		e |= 0x4
-	}
-	switch f.quickCheck[MComposed] {
-	case QCYes:
-	case QCNo:
-		e |= 0x10
-	case QCMaybe:
-		e |= 0x18
-	default:
-		log.Fatalf("Illegal quickcheck value %v.", f.quickCheck[MComposed])
-	}
-	e |= uint16(c.nTrailingNonStarters)
-	return e
-}
-
-// decompSet keeps track of unique decompositions, grouped by whether
-// the decomposition is followed by a trailing and/or leading CCC.
-type decompSet [7]map[string]bool
-
-const (
-	normalDecomp = iota
-	firstMulti
-	firstCCC
-	endMulti
-	firstLeadingCCC
-	firstCCCZeroExcept
-	firstStarterWithNLead
-	lastDecomp
-)
-
-var cname = []string{"firstMulti", "firstCCC", "endMulti", "firstLeadingCCC", "firstCCCZeroExcept", "firstStarterWithNLead", "lastDecomp"}
-
-func makeDecompSet() decompSet {
-	m := decompSet{}
-	for i := range m {
-		m[i] = make(map[string]bool)
-	}
-	return m
-}
-func (m *decompSet) insert(key int, s string) {
-	m[key][s] = true
-}
-
-func printCharInfoTables(w io.Writer) int {
-	mkstr := func(r rune, f *FormInfo) (int, string) {
-		d := f.expandedDecomp
-		s := string([]rune(d))
-		if max := 1 << 6; len(s) >= max {
-			const msg = "%U: too many bytes in decomposition: %d >= %d"
-			log.Fatalf(msg, r, len(s), max)
-		}
-		head := uint8(len(s))
-		if f.quickCheck[MComposed] != QCYes {
-			head |= 0x40
-		}
-		if f.combinesForward {
-			head |= 0x80
-		}
-		s = string([]byte{head}) + s
-
-		lccc := ccc(d[0])
-		tccc := ccc(d[len(d)-1])
-		cc := ccc(r)
-		if cc != 0 && lccc == 0 && tccc == 0 {
-			log.Fatalf("%U: trailing and leading ccc are 0 for non-zero ccc %d", r, cc)
-		}
-		if tccc < lccc && lccc != 0 {
-			const msg = "%U: lccc (%d) must be <= tcc (%d)"
-			log.Fatalf(msg, r, lccc, tccc)
-		}
-		index := normalDecomp
-		nTrail := chars[r].nTrailingNonStarters
-		nLead := chars[r].nLeadingNonStarters
-		if tccc > 0 || lccc > 0 || nTrail > 0 {
-			tccc <<= 2
-			tccc |= nTrail
-			s += string([]byte{tccc})
-			index = endMulti
-			for _, r := range d[1:] {
-				if ccc(r) == 0 {
-					index = firstCCC
-				}
-			}
-			if lccc > 0 || nLead > 0 {
-				s += string([]byte{lccc})
-				if index == firstCCC {
-					log.Fatalf("%U: multi-segment decomposition not supported for decompositions with leading CCC != 0", r)
-				}
-				index = firstLeadingCCC
-			}
-			if cc != lccc {
-				if cc != 0 {
-					log.Fatalf("%U: for lccc != ccc, expected ccc to be 0; was %d", r, cc)
-				}
-				index = firstCCCZeroExcept
-			}
-		} else if len(d) > 1 {
-			index = firstMulti
-		}
-		return index, s
-	}
-
-	decompSet := makeDecompSet()
-	const nLeadStr = "\x00\x01" // 0-byte length and tccc with nTrail.
-	decompSet.insert(firstStarterWithNLead, nLeadStr)
-
-	// Store the uniqued decompositions in a byte buffer,
-	// preceded by their byte length.
-	for _, c := range chars {
-		for _, f := range c.forms {
-			if len(f.expandedDecomp) == 0 {
-				continue
-			}
-			if f.combinesBackward {
-				log.Fatalf("%U: combinesBackward and decompose", c.codePoint)
-			}
-			index, s := mkstr(c.codePoint, &f)
-			decompSet.insert(index, s)
-		}
-	}
-
-	decompositions := bytes.NewBuffer(make([]byte, 0, 10000))
-	size := 0
-	positionMap := make(map[string]uint16)
-	decompositions.WriteString("\000")
-	fmt.Fprintln(w, "const (")
-	for i, m := range decompSet {
-		sa := []string{}
-		for s := range m {
-			sa = append(sa, s)
-		}
-		sort.Strings(sa)
-		for _, s := range sa {
-			p := decompositions.Len()
-			decompositions.WriteString(s)
-			positionMap[s] = uint16(p)
-		}
-		if cname[i] != "" {
-			fmt.Fprintf(w, "%s = 0x%X\n", cname[i], decompositions.Len())
-		}
-	}
-	fmt.Fprintln(w, "maxDecomp = 0x8000")
-	fmt.Fprintln(w, ")")
-	b := decompositions.Bytes()
-	printBytes(w, b, "decomps")
-	size += len(b)
-
-	varnames := []string{"nfc", "nfkc"}
-	for i := 0; i < FNumberOfFormTypes; i++ {
-		trie := triegen.NewTrie(varnames[i])
-
-		for r, c := range chars {
-			f := c.forms[i]
-			d := f.expandedDecomp
-			if len(d) != 0 {
-				_, key := mkstr(c.codePoint, &f)
-				trie.Insert(rune(r), uint64(positionMap[key]))
-				if c.ccc != ccc(d[0]) {
-					// We assume the lead ccc of a decomposition !=0 in this case.
-					if ccc(d[0]) == 0 {
-						log.Fatalf("Expected leading CCC to be non-zero; ccc is %d", c.ccc)
-					}
-				}
-			} else if c.nLeadingNonStarters > 0 && len(f.expandedDecomp) == 0 && c.ccc == 0 && !f.combinesBackward {
-				// Handle cases where it can't be detected that the nLead should be equal
-				// to nTrail.
-				trie.Insert(c.codePoint, uint64(positionMap[nLeadStr]))
-			} else if v := makeEntry(&f, &c)<<8 | uint16(c.ccc); v != 0 {
-				trie.Insert(c.codePoint, uint64(0x8000|v))
-			}
-		}
-		sz, err := trie.Gen(w, triegen.Compact(&normCompacter{name: varnames[i]}))
-		if err != nil {
-			log.Fatal(err)
-		}
-		size += sz
-	}
-	return size
-}
-
-func contains(sa []string, s string) bool {
-	for _, a := range sa {
-		if a == s {
-			return true
-		}
-	}
-	return false
-}
-
-func makeTables() {
-	w := &bytes.Buffer{}
-
-	size := 0
-	if *tablelist == "" {
-		return
-	}
-	list := strings.Split(*tablelist, ",")
-	if *tablelist == "all" {
-		list = []string{"recomp", "info"}
-	}
-
-	// Compute maximum decomposition size.
-	max := 0
-	for _, c := range chars {
-		if n := len(string(c.forms[FCompatibility].expandedDecomp)); n > max {
-			max = n
-		}
-	}
-	fmt.Fprintln(w, `import "sync"`)
-	fmt.Fprintln(w)
-
-	fmt.Fprintln(w, "const (")
-	fmt.Fprintln(w, "\t// Version is the Unicode edition from which the tables are derived.")
-	fmt.Fprintf(w, "\tVersion = %q\n", gen.UnicodeVersion())
-	fmt.Fprintln(w)
-	fmt.Fprintln(w, "\t// MaxTransformChunkSize indicates the maximum number of bytes that Transform")
-	fmt.Fprintln(w, "\t// may need to write atomically for any Form. Making a destination buffer at")
-	fmt.Fprintln(w, "\t// least this size ensures that Transform can always make progress and that")
-	fmt.Fprintln(w, "\t// the user does not need to grow the buffer on an ErrShortDst.")
-	fmt.Fprintf(w, "\tMaxTransformChunkSize = %d+maxNonStarters*4\n", len(string(0x034F))+max)
-	fmt.Fprintln(w, ")\n")
-
-	// Print the CCC remap table.
-	size += len(cccMap)
-	fmt.Fprintf(w, "var ccc = [%d]uint8{", len(cccMap))
-	for i := 0; i < len(cccMap); i++ {
-		if i%8 == 0 {
-			fmt.Fprintln(w)
-		}
-		fmt.Fprintf(w, "%3d, ", cccMap[uint8(i)])
-	}
-	fmt.Fprintln(w, "\n}\n")
-
-	if contains(list, "info") {
-		size += printCharInfoTables(w)
-	}
-
-	if contains(list, "recomp") {
-		// Note that we use 32 bit keys, instead of 64 bit.
-		// This clips the bits of three entries, but we know
-		// this won't cause a collision. The compiler will catch
-		// any changes made to UnicodeData.txt that introduces
-		// a collision.
-		// Note that the recomposition map for NFC and NFKC
-		// are identical.
-
-		// Recomposition map
-		nrentries := 0
-		for _, c := range chars {
-			f := c.forms[FCanonical]
-			if !f.isOneWay && len(f.decomp) > 0 {
-				nrentries++
-			}
-		}
-		sz := nrentries * 8
-		size += sz
-		fmt.Fprintf(w, "// recompMap: %d bytes (entries only)\n", sz)
-		fmt.Fprintln(w, "var recompMap map[uint32]rune")
-		fmt.Fprintln(w, "var recompMapOnce sync.Once\n")
-		fmt.Fprintln(w, `const recompMapPacked = "" +`)
-		var buf [8]byte
-		for i, c := range chars {
-			f := c.forms[FCanonical]
-			d := f.decomp
-			if !f.isOneWay && len(d) > 0 {
-				key := uint32(uint16(d[0]))<<16 + uint32(uint16(d[1]))
-				binary.BigEndian.PutUint32(buf[:4], key)
-				binary.BigEndian.PutUint32(buf[4:], uint32(i))
-				fmt.Fprintf(w, "\t\t%q + // 0x%.8X: 0x%.8X\n", string(buf[:]), key, uint32(i))
-			}
-		}
-		// hack so we don't have to special case the trailing plus sign
-		fmt.Fprintf(w, `	""`)
-		fmt.Fprintln(w)
-	}
-
-	fmt.Fprintf(w, "// Total size of tables: %dKB (%d bytes)\n", (size+512)/1024, size)
-	gen.WriteVersionedGoFile("tables.go", "norm", w.Bytes())
-}
-
-func printChars() {
-	if *verbose {
-		for _, c := range chars {
-			if !c.isValid() || c.state == SMissing {
-				continue
-			}
-			fmt.Println(c)
-		}
-	}
-}
-
-// verifyComputed does various consistency tests.
-func verifyComputed() {
-	for i, c := range chars {
-		for _, f := range c.forms {
-			isNo := (f.quickCheck[MDecomposed] == QCNo)
-			if (len(f.decomp) > 0) != isNo && !isHangul(rune(i)) {
-				log.Fatalf("%U: NF*D QC must be No if rune decomposes", i)
-			}
-
-			isMaybe := f.quickCheck[MComposed] == QCMaybe
-			if f.combinesBackward != isMaybe {
-				log.Fatalf("%U: NF*C QC must be Maybe if combinesBackward", i)
-			}
-			if len(f.decomp) > 0 && f.combinesForward && isMaybe {
-				log.Fatalf("%U: NF*C QC must be Yes or No if combinesForward and decomposes", i)
-			}
-
-			if len(f.expandedDecomp) != 0 {
-				continue
-			}
-			if a, b := c.nLeadingNonStarters > 0, (c.ccc > 0 || f.combinesBackward); a != b {
-				// We accept these runes to be treated differently (it only affects
-				// segment breaking in iteration, most likely on improper use), but
-				// reconsider if more characters are added.
-				// U+FF9E HALFWIDTH KATAKANA VOICED SOUND MARK;Lm;0;L;<narrow> 3099;;;;N;;;;;
-				// U+FF9F HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK;Lm;0;L;<narrow> 309A;;;;N;;;;;
-				// U+3133 HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<compat> 11AA;;;;N;HANGUL LETTER GIYEOG SIOS;;;;
-				// U+318E HANGUL LETTER ARAEAE;Lo;0;L;<compat> 11A1;;;;N;HANGUL LETTER ALAE AE;;;;
-				// U+FFA3 HALFWIDTH HANGUL LETTER KIYEOK-SIOS;Lo;0;L;<narrow> 3133;;;;N;HALFWIDTH HANGUL LETTER GIYEOG SIOS;;;;
-				// U+FFDC HALFWIDTH HANGUL LETTER I;Lo;0;L;<narrow> 3163;;;;N;;;;;
-				if i != 0xFF9E && i != 0xFF9F && !(0x3133 <= i && i <= 0x318E) && !(0xFFA3 <= i && i <= 0xFFDC) {
-					log.Fatalf("%U: nLead was %v; want %v", i, a, b)
-				}
-			}
-		}
-		nfc := c.forms[FCanonical]
-		nfkc := c.forms[FCompatibility]
-		if nfc.combinesBackward != nfkc.combinesBackward {
-			log.Fatalf("%U: Cannot combine combinesBackward\n", c.codePoint)
-		}
-	}
-}
-
-// Use values in DerivedNormalizationProps.txt to compare against the
-// values we computed.
-// DerivedNormalizationProps.txt has form:
-// 00C0..00C5    ; NFD_QC; N # ...
-// 0374          ; NFD_QC; N # ...
-// See https://unicode.org/reports/tr44/ for full explanation
-func testDerived() {
-	f := gen.OpenUCDFile("DerivedNormalizationProps.txt")
-	defer f.Close()
-	p := ucd.New(f)
-	for p.Next() {
-		r := p.Rune(0)
-		c := &chars[r]
-
-		var ftype, mode int
-		qt := p.String(1)
-		switch qt {
-		case "NFC_QC":
-			ftype, mode = FCanonical, MComposed
-		case "NFD_QC":
-			ftype, mode = FCanonical, MDecomposed
-		case "NFKC_QC":
-			ftype, mode = FCompatibility, MComposed
-		case "NFKD_QC":
-			ftype, mode = FCompatibility, MDecomposed
-		default:
-			continue
-		}
-		var qr QCResult
-		switch p.String(2) {
-		case "Y":
-			qr = QCYes
-		case "N":
-			qr = QCNo
-		case "M":
-			qr = QCMaybe
-		default:
-			log.Fatalf(`Unexpected quick check value "%s"`, p.String(2))
-		}
-		if got := c.forms[ftype].quickCheck[mode]; got != qr {
-			log.Printf("%U: FAILED %s (was %v need %v)\n", r, qt, got, qr)
-		}
-		c.forms[ftype].verified[mode] = true
-	}
-	if err := p.Err(); err != nil {
-		log.Fatal(err)
-	}
-	// Any unspecified value must be QCYes. Verify this.
-	for i, c := range chars {
-		for j, fd := range c.forms {
-			for k, qr := range fd.quickCheck {
-				if !fd.verified[k] && qr != QCYes {
-					m := "%U: FAIL F:%d M:%d (was %v need Yes) %s\n"
-					log.Printf(m, i, j, k, qr, c.name)
-				}
-			}
-		}
-	}
-}
-
-var testHeader = `const (
-	Yes = iota
-	No
-	Maybe
-)
-
-type formData struct {
-	qc              uint8
-	combinesForward bool
-	decomposition   string
-}
-
-type runeData struct {
-	r      rune
-	ccc    uint8
-	nLead  uint8
-	nTrail uint8
-	f      [2]formData // 0: canonical; 1: compatibility
-}
-
-func f(qc uint8, cf bool, dec string) [2]formData {
-	return [2]formData{{qc, cf, dec}, {qc, cf, dec}}
-}
-
-func g(qc, qck uint8, cf, cfk bool, d, dk string) [2]formData {
-	return [2]formData{{qc, cf, d}, {qck, cfk, dk}}
-}
-
-var testData = []runeData{
-`
-
-func printTestdata() {
-	type lastInfo struct {
-		ccc    uint8
-		nLead  uint8
-		nTrail uint8
-		f      string
-	}
-
-	last := lastInfo{}
-	w := &bytes.Buffer{}
-	fmt.Fprintf(w, testHeader)
-	for r, c := range chars {
-		f := c.forms[FCanonical]
-		qc, cf, d := f.quickCheck[MComposed], f.combinesForward, string(f.expandedDecomp)
-		f = c.forms[FCompatibility]
-		qck, cfk, dk := f.quickCheck[MComposed], f.combinesForward, string(f.expandedDecomp)
-		s := ""
-		if d == dk && qc == qck && cf == cfk {
-			s = fmt.Sprintf("f(%s, %v, %q)", qc, cf, d)
-		} else {
-			s = fmt.Sprintf("g(%s, %s, %v, %v, %q, %q)", qc, qck, cf, cfk, d, dk)
-		}
-		current := lastInfo{c.ccc, c.nLeadingNonStarters, c.nTrailingNonStarters, s}
-		if last != current {
-			fmt.Fprintf(w, "\t{0x%x, %d, %d, %d, %s},\n", r, c.origCCC, c.nLeadingNonStarters, c.nTrailingNonStarters, s)
-			last = current
-		}
-	}
-	fmt.Fprintln(w, "}")
-	gen.WriteVersionedGoFile("data_test.go", "norm", w.Bytes())
-}
diff --git a/vendor/golang.org/x/text/unicode/norm/triegen.go b/vendor/golang.org/x/text/unicode/norm/triegen.go
deleted file mode 100644
index 45d7119..0000000
--- a/vendor/golang.org/x/text/unicode/norm/triegen.go
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-// Trie table generator.
-// Used by make*tables tools to generate a go file with trie data structures
-// for mapping UTF-8 to a 16-bit value. All but the last byte in a UTF-8 byte
-// sequence are used to lookup offsets in the index table to be used for the
-// next byte. The last byte is used to index into a table with 16-bit values.
-
-package main
-
-import (
-	"fmt"
-	"io"
-)
-
-const maxSparseEntries = 16
-
-type normCompacter struct {
-	sparseBlocks [][]uint64
-	sparseOffset []uint16
-	sparseCount  int
-	name         string
-}
-
-func mostFrequentStride(a []uint64) int {
-	counts := make(map[int]int)
-	var v int
-	for _, x := range a {
-		if stride := int(x) - v; v != 0 && stride >= 0 {
-			counts[stride]++
-		}
-		v = int(x)
-	}
-	var maxs, maxc int
-	for stride, cnt := range counts {
-		if cnt > maxc || (cnt == maxc && stride < maxs) {
-			maxs, maxc = stride, cnt
-		}
-	}
-	return maxs
-}
-
-func countSparseEntries(a []uint64) int {
-	stride := mostFrequentStride(a)
-	var v, count int
-	for _, tv := range a {
-		if int(tv)-v != stride {
-			if tv != 0 {
-				count++
-			}
-		}
-		v = int(tv)
-	}
-	return count
-}
-
-func (c *normCompacter) Size(v []uint64) (sz int, ok bool) {
-	if n := countSparseEntries(v); n <= maxSparseEntries {
-		return (n+1)*4 + 2, true
-	}
-	return 0, false
-}
-
-func (c *normCompacter) Store(v []uint64) uint32 {
-	h := uint32(len(c.sparseOffset))
-	c.sparseBlocks = append(c.sparseBlocks, v)
-	c.sparseOffset = append(c.sparseOffset, uint16(c.sparseCount))
-	c.sparseCount += countSparseEntries(v) + 1
-	return h
-}
-
-func (c *normCompacter) Handler() string {
-	return c.name + "Sparse.lookup"
-}
-
-func (c *normCompacter) Print(w io.Writer) (retErr error) {
-	p := func(f string, x ...interface{}) {
-		if _, err := fmt.Fprintf(w, f, x...); retErr == nil && err != nil {
-			retErr = err
-		}
-	}
-
-	ls := len(c.sparseBlocks)
-	p("// %sSparseOffset: %d entries, %d bytes\n", c.name, ls, ls*2)
-	p("var %sSparseOffset = %#v\n\n", c.name, c.sparseOffset)
-
-	ns := c.sparseCount
-	p("// %sSparseValues: %d entries, %d bytes\n", c.name, ns, ns*4)
-	p("var %sSparseValues = [%d]valueRange {", c.name, ns)
-	for i, b := range c.sparseBlocks {
-		p("\n// Block %#x, offset %#x", i, c.sparseOffset[i])
-		var v int
-		stride := mostFrequentStride(b)
-		n := countSparseEntries(b)
-		p("\n{value:%#04x,lo:%#02x},", stride, uint8(n))
-		for i, nv := range b {
-			if int(nv)-v != stride {
-				if v != 0 {
-					p(",hi:%#02x},", 0x80+i-1)
-				}
-				if nv != 0 {
-					p("\n{value:%#04x,lo:%#02x", nv, 0x80+i)
-				}
-			}
-			v = int(nv)
-		}
-		if v != 0 {
-			p(",hi:%#02x},", 0x80+len(b)-1)
-		}
-	}
-	p("\n}\n\n")
-	return
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index b9b39d0..6888974 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -23,18 +23,17 @@
 # github.com/eapache/queue v1.1.0
 github.com/eapache/queue
 # github.com/gogo/protobuf v1.3.0
-github.com/gogo/protobuf/proto
 github.com/gogo/protobuf/gogoproto
+github.com/gogo/protobuf/proto
 github.com/gogo/protobuf/protoc-gen-gogo/descriptor
 # github.com/golang/protobuf v1.3.2
-github.com/golang/protobuf/ptypes
 github.com/golang/protobuf/proto
-github.com/golang/protobuf/ptypes/any
-github.com/golang/protobuf/ptypes/empty
-github.com/golang/protobuf/ptypes/duration
-github.com/golang/protobuf/ptypes/timestamp
 github.com/golang/protobuf/protoc-gen-go/descriptor
-github.com/golang/protobuf/descriptor
+github.com/golang/protobuf/ptypes
+github.com/golang/protobuf/ptypes/any
+github.com/golang/protobuf/ptypes/duration
+github.com/golang/protobuf/ptypes/empty
+github.com/golang/protobuf/ptypes/timestamp
 # github.com/golang/snappy v0.0.1
 github.com/golang/snappy
 # github.com/google/uuid v1.1.1
@@ -60,48 +59,48 @@
 github.com/mitchellh/go-homedir
 # github.com/mitchellh/mapstructure v1.1.2
 github.com/mitchellh/mapstructure
-# github.com/opencord/voltha-lib-go/v2 v2.2.9
+# github.com/opencord/voltha-lib-go/v2 v2.2.10
 github.com/opencord/voltha-lib-go/v2/pkg/adapters
 github.com/opencord/voltha-lib-go/v2/pkg/adapters/adapterif
 github.com/opencord/voltha-lib-go/v2/pkg/adapters/common
+github.com/opencord/voltha-lib-go/v2/pkg/db
 github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore
+github.com/opencord/voltha-lib-go/v2/pkg/flows
 github.com/opencord/voltha-lib-go/v2/pkg/kafka
 github.com/opencord/voltha-lib-go/v2/pkg/log
-github.com/opencord/voltha-lib-go/v2/pkg/probe
-github.com/opencord/voltha-lib-go/v2/pkg/flows
 github.com/opencord/voltha-lib-go/v2/pkg/pmmetrics
-github.com/opencord/voltha-lib-go/v2/pkg/techprofile
-github.com/opencord/voltha-lib-go/v2/pkg/db/model
 github.com/opencord/voltha-lib-go/v2/pkg/ponresourcemanager
+github.com/opencord/voltha-lib-go/v2/pkg/probe
+github.com/opencord/voltha-lib-go/v2/pkg/techprofile
 # github.com/opencord/voltha-protos/v2 v2.0.1
-github.com/opencord/voltha-protos/v2/go/inter_container
-github.com/opencord/voltha-protos/v2/go/voltha
 github.com/opencord/voltha-protos/v2/go/common
+github.com/opencord/voltha-protos/v2/go/inter_container
+github.com/opencord/voltha-protos/v2/go/omci
 github.com/opencord/voltha-protos/v2/go/openflow_13
 github.com/opencord/voltha-protos/v2/go/openolt
 github.com/opencord/voltha-protos/v2/go/tech_profile
-github.com/opencord/voltha-protos/v2/go/omci
+github.com/opencord/voltha-protos/v2/go/voltha
 # github.com/pierrec/lz4 v2.3.0+incompatible
 github.com/pierrec/lz4
 github.com/pierrec/lz4/internal/xxh32
 # github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563
 github.com/rcrowley/go-metrics
 # go.etcd.io/etcd v0.0.0-20190930204107-236ac2a90522
-go.etcd.io/etcd/clientv3
-go.etcd.io/etcd/clientv3/concurrency
-go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes
-go.etcd.io/etcd/pkg/mock/mockserver
 go.etcd.io/etcd/auth/authpb
+go.etcd.io/etcd/clientv3
 go.etcd.io/etcd/clientv3/balancer
+go.etcd.io/etcd/clientv3/balancer/connectivity
 go.etcd.io/etcd/clientv3/balancer/picker
 go.etcd.io/etcd/clientv3/balancer/resolver/endpoint
+go.etcd.io/etcd/clientv3/concurrency
 go.etcd.io/etcd/clientv3/credentials
+go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes
 go.etcd.io/etcd/etcdserver/etcdserverpb
 go.etcd.io/etcd/mvcc/mvccpb
 go.etcd.io/etcd/pkg/logutil
-go.etcd.io/etcd/pkg/types
-go.etcd.io/etcd/clientv3/balancer/connectivity
+go.etcd.io/etcd/pkg/mock/mockserver
 go.etcd.io/etcd/pkg/systemd
+go.etcd.io/etcd/pkg/types
 go.etcd.io/etcd/raft
 go.etcd.io/etcd/raft/confchange
 go.etcd.io/etcd/raft/quorum
@@ -113,43 +112,44 @@
 go.uber.org/multierr
 # go.uber.org/zap v1.10.0
 go.uber.org/zap
-go.uber.org/zap/zapcore
-go.uber.org/zap/internal/bufferpool
 go.uber.org/zap/buffer
+go.uber.org/zap/internal/bufferpool
 go.uber.org/zap/internal/color
 go.uber.org/zap/internal/exit
+go.uber.org/zap/zapcore
 # golang.org/x/crypto v0.0.0-20191001170739-f9e2070545dc
 golang.org/x/crypto/md4
 golang.org/x/crypto/pbkdf2
 # golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3
-golang.org/x/net/trace
-golang.org/x/net/proxy
-golang.org/x/net/internal/timeseries
+golang.org/x/net/context
+golang.org/x/net/http/httpguts
 golang.org/x/net/http2
 golang.org/x/net/http2/hpack
-golang.org/x/net/context
-golang.org/x/net/internal/socks
-golang.org/x/net/http/httpguts
 golang.org/x/net/idna
+golang.org/x/net/internal/socks
+golang.org/x/net/internal/timeseries
+golang.org/x/net/proxy
+golang.org/x/net/trace
 # golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24
 golang.org/x/sys/unix
 # golang.org/x/text v0.3.2
 golang.org/x/text/secure/bidirule
+golang.org/x/text/transform
 golang.org/x/text/unicode/bidi
 golang.org/x/text/unicode/norm
-golang.org/x/text/transform
 # google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c
 google.golang.org/genproto/googleapis/api/annotations
 google.golang.org/genproto/googleapis/rpc/status
 # google.golang.org/grpc v1.24.0
 google.golang.org/grpc
-google.golang.org/grpc/codes
-google.golang.org/grpc/status
-google.golang.org/grpc/metadata
 google.golang.org/grpc/balancer
+google.golang.org/grpc/balancer/base
 google.golang.org/grpc/balancer/roundrobin
+google.golang.org/grpc/binarylog/grpc_binarylog_v1
+google.golang.org/grpc/codes
 google.golang.org/grpc/connectivity
 google.golang.org/grpc/credentials
+google.golang.org/grpc/credentials/internal
 google.golang.org/grpc/encoding
 google.golang.org/grpc/encoding/proto
 google.golang.org/grpc/grpclog
@@ -161,8 +161,10 @@
 google.golang.org/grpc/internal/envconfig
 google.golang.org/grpc/internal/grpcrand
 google.golang.org/grpc/internal/grpcsync
+google.golang.org/grpc/internal/syscall
 google.golang.org/grpc/internal/transport
 google.golang.org/grpc/keepalive
+google.golang.org/grpc/metadata
 google.golang.org/grpc/naming
 google.golang.org/grpc/peer
 google.golang.org/grpc/resolver
@@ -170,11 +172,8 @@
 google.golang.org/grpc/resolver/passthrough
 google.golang.org/grpc/serviceconfig
 google.golang.org/grpc/stats
+google.golang.org/grpc/status
 google.golang.org/grpc/tap
-google.golang.org/grpc/balancer/base
-google.golang.org/grpc/credentials/internal
-google.golang.org/grpc/binarylog/grpc_binarylog_v1
-google.golang.org/grpc/internal/syscall
 # gopkg.in/jcmturner/aescts.v1 v1.0.1
 gopkg.in/jcmturner/aescts.v1
 # gopkg.in/jcmturner/dnsutils.v1 v1.0.1
@@ -184,32 +183,32 @@
 gopkg.in/jcmturner/gokrb5.v7/client
 gopkg.in/jcmturner/gokrb5.v7/config
 gopkg.in/jcmturner/gokrb5.v7/credentials
-gopkg.in/jcmturner/gokrb5.v7/gssapi
-gopkg.in/jcmturner/gokrb5.v7/iana/chksumtype
-gopkg.in/jcmturner/gokrb5.v7/iana/keyusage
-gopkg.in/jcmturner/gokrb5.v7/keytab
-gopkg.in/jcmturner/gokrb5.v7/messages
-gopkg.in/jcmturner/gokrb5.v7/types
 gopkg.in/jcmturner/gokrb5.v7/crypto
-gopkg.in/jcmturner/gokrb5.v7/crypto/etype
-gopkg.in/jcmturner/gokrb5.v7/iana/errorcode
-gopkg.in/jcmturner/gokrb5.v7/iana/flags
-gopkg.in/jcmturner/gokrb5.v7/iana/nametype
-gopkg.in/jcmturner/gokrb5.v7/iana/patype
-gopkg.in/jcmturner/gokrb5.v7/kadmin
-gopkg.in/jcmturner/gokrb5.v7/krberror
-gopkg.in/jcmturner/gokrb5.v7/iana/etypeID
-gopkg.in/jcmturner/gokrb5.v7/iana
-gopkg.in/jcmturner/gokrb5.v7/iana/adtype
-gopkg.in/jcmturner/gokrb5.v7/iana/asnAppTag
-gopkg.in/jcmturner/gokrb5.v7/iana/msgtype
-gopkg.in/jcmturner/gokrb5.v7/pac
-gopkg.in/jcmturner/gokrb5.v7/iana/addrtype
 gopkg.in/jcmturner/gokrb5.v7/crypto/common
+gopkg.in/jcmturner/gokrb5.v7/crypto/etype
 gopkg.in/jcmturner/gokrb5.v7/crypto/rfc3961
 gopkg.in/jcmturner/gokrb5.v7/crypto/rfc3962
 gopkg.in/jcmturner/gokrb5.v7/crypto/rfc4757
 gopkg.in/jcmturner/gokrb5.v7/crypto/rfc8009
+gopkg.in/jcmturner/gokrb5.v7/gssapi
+gopkg.in/jcmturner/gokrb5.v7/iana
+gopkg.in/jcmturner/gokrb5.v7/iana/addrtype
+gopkg.in/jcmturner/gokrb5.v7/iana/adtype
+gopkg.in/jcmturner/gokrb5.v7/iana/asnAppTag
+gopkg.in/jcmturner/gokrb5.v7/iana/chksumtype
+gopkg.in/jcmturner/gokrb5.v7/iana/errorcode
+gopkg.in/jcmturner/gokrb5.v7/iana/etypeID
+gopkg.in/jcmturner/gokrb5.v7/iana/flags
+gopkg.in/jcmturner/gokrb5.v7/iana/keyusage
+gopkg.in/jcmturner/gokrb5.v7/iana/msgtype
+gopkg.in/jcmturner/gokrb5.v7/iana/nametype
+gopkg.in/jcmturner/gokrb5.v7/iana/patype
+gopkg.in/jcmturner/gokrb5.v7/kadmin
+gopkg.in/jcmturner/gokrb5.v7/keytab
+gopkg.in/jcmturner/gokrb5.v7/krberror
+gopkg.in/jcmturner/gokrb5.v7/messages
+gopkg.in/jcmturner/gokrb5.v7/pac
+gopkg.in/jcmturner/gokrb5.v7/types
 # gopkg.in/jcmturner/rpc.v1 v1.1.0
 gopkg.in/jcmturner/rpc.v1/mstypes
 gopkg.in/jcmturner/rpc.v1/ndr
