[SEBA-884] read config from file

Change-Id: I09c24f5c9504a51d804e68a99a2ac3a02d730573
diff --git a/cmd/bbr/bbr.go b/cmd/bbr/bbr.go
index 7d01417..6ffcce6 100644
--- a/cmd/bbr/bbr.go
+++ b/cmd/bbr/bbr.go
@@ -36,7 +36,7 @@
 func main() {
 	options := common.GetBBROpts()
 
-	common.SetLogLevel(log.StandardLogger(), options.LogLevel, options.LogCaller)
+	common.SetLogLevel(log.StandardLogger(), options.BBR.LogLevel, options.BBR.LogCaller)
 
 	if options.LogFile != "" {
 		file, err := os.OpenFile(options.LogFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
@@ -47,10 +47,10 @@
 		}
 	}
 
-	if *options.ProfileCpu != "" {
+	if *options.BBSim.CpuProfile != "" {
 		// start profiling
-		log.Infof("Creating profile file at: %s", *options.ProfileCpu)
-		f, err := os.Create(*options.ProfileCpu)
+		log.Infof("Creating profile file at: %s", *options.BBSim.CpuProfile)
+		f, err := os.Create(*options.BBSim.CpuProfile)
 		if err != nil {
 			log.Fatal(err)
 		}
@@ -58,22 +58,22 @@
 	}
 
 	log.WithFields(log.Fields{
-		"OltID":        options.OltID,
-		"NumNniPerOlt": options.NumNniPerOlt,
-		"NumPonPerOlt": options.NumPonPerOlt,
-		"NumOnuPerPon": options.NumOnuPerPon,
+		"OltID":        options.Olt.ID,
+		"NumNniPerOlt": options.Olt.NniPorts,
+		"NumPonPerOlt": options.Olt.PonPorts,
+		"NumOnuPerPon": options.Olt.OnusPonPort,
 		"BBSimIp":      options.BBSimIp,
 		"BBSimPort":    options.BBSimPort,
 	}).Info("BroadBand Reflector is on")
 
 	// create the OLT device
 	olt := devices.CreateOLT(
-		options.OltID,
-		options.NumNniPerOlt,
-		options.NumPonPerOlt,
-		options.NumOnuPerPon,
-		options.STag,
-		options.CTagInit,
+		options.Olt.ID,
+		int(options.Olt.NniPorts),
+		int(options.Olt.PonPorts),
+		int(options.Olt.OnusPonPort),
+		options.BBSim.STag,
+		options.BBSim.CTagInit,
 		true, // this parameter is not important in the BBR Case
 		true, // this parameter is not important in the BBR Case
 		0,    // this parameter does not matter in the BBR case
@@ -81,7 +81,7 @@
 	)
 	oltMock := bbrdevices.OltMock{
 		Olt:           olt,
-		TargetOnus:    options.NumPonPerOlt * options.NumOnuPerPon,
+		TargetOnus:    int(options.Olt.PonPorts * options.Olt.OnusPonPort),
 		CompletedOnus: 0,
 		BBSimIp:       options.BBSimIp,
 		BBSimPort:     options.BBSimPort,
diff --git a/cmd/bbsim/bbsim.go b/cmd/bbsim/bbsim.go
index 23221c6..52d5772 100644
--- a/cmd/bbsim/bbsim.go
+++ b/cmd/bbsim/bbsim.go
@@ -38,8 +38,7 @@
 )
 
 func startApiServer(apiDoneChannel chan bool, group *sync.WaitGroup) {
-	// TODO make configurable
-	address := "0.0.0.0:50070"
+	address := common.Options.BBSim.ApiAddress
 	log.Debugf("APIServer listening on: %v", address)
 	lis, err := net.Listen("tcp", address)
 	if err != nil {
@@ -69,8 +68,7 @@
 	ctx, cancel := context.WithCancel(ctx)
 	defer cancel()
 
-	// TODO make configurable
-	address := "0.0.0.0:50071"
+	address := common.Options.BBSim.RestApiAddress
 
 	mux := runtime.NewServeMux()
 	opts := []grpc.DialOption{grpc.WithInsecure()}
@@ -101,9 +99,8 @@
 
 // This server aims to provide compatibility with the previous BBSim version. It is deprecated and will be removed in the future.
 func startLegacyApiServer(apiDoneChannel chan bool, group *sync.WaitGroup) {
-	// TODO make configurable
-	grpcAddress := "0.0.0.0:50072"
-	restAddress := "0.0.0.0:50073"
+	grpcAddress := common.Options.BBSim.LegacyApiAddress
+	restAddress := common.Options.BBSim.LegacyRestApiAddress
 
 	log.Debugf("Legacy APIServer listening on: %v", grpcAddress)
 	listener, err := net.Listen("tcp", grpcAddress)
@@ -131,14 +128,16 @@
 }
 
 func main() {
+
 	options := common.GetBBSimOpts()
 
-	common.SetLogLevel(log.StandardLogger(), options.LogLevel, options.LogCaller)
+	common.SetLogLevel(log.StandardLogger(), options.BBSim.LogLevel, options.BBSim.LogCaller)
+	log.Tracef("BBSim options: %+v", options)
 
-	if *options.ProfileCpu != "" {
+	if *options.BBSim.CpuProfile != "" {
 		// start profiling
-		log.Infof("Creating profile file at: %s", *options.ProfileCpu)
-		f, err := os.Create(*options.ProfileCpu)
+		log.Infof("Creating profile file at: %s", *options.BBSim.CpuProfile)
+		f, err := os.Create(*options.BBSim.CpuProfile)
 		if err != nil {
 			log.Fatal(err)
 		}
@@ -146,33 +145,33 @@
 	}
 
 	log.WithFields(log.Fields{
-		"OltID":        options.OltID,
-		"NumNniPerOlt": options.NumNniPerOlt,
-		"NumPonPerOlt": options.NumPonPerOlt,
-		"NumOnuPerPon": options.NumOnuPerPon,
-		"TotalOnus":    options.NumPonPerOlt * options.NumOnuPerPon,
-		"Auth":         options.Auth,
-		"Dhcp":         options.Dhcp,
-		"Delay":        options.Delay,
+		"OltID":        options.Olt.ID,
+		"NumNniPerOlt": options.Olt.NniPorts,
+		"NumPonPerOlt": options.Olt.PonPorts,
+		"NumOnuPerPon": options.Olt.OnusPonPort,
+		"TotalOnus":    options.Olt.PonPorts * options.Olt.OnusPonPort,
+		"EnableAuth":   options.BBSim.EnableAuth,
+		"Dhcp":         options.BBSim.EnableDhcp,
+		"Delay":        options.BBSim.Delay,
 	}).Info("BroadBand Simulator is on")
 
 	// control channels, they are only closed when the goroutine needs to be terminated
 	apiDoneChannel := make(chan bool)
 
 	devices.CreateOLT(
-		options.OltID,
-		options.NumNniPerOlt,
-		options.NumPonPerOlt,
-		options.NumOnuPerPon,
-		options.STag,
-		options.CTagInit,
-		options.Auth,
-		options.Dhcp,
-		options.Delay,
+		options.Olt.ID,
+		int(options.Olt.NniPorts),
+		int(options.Olt.PonPorts),
+		int(options.Olt.OnusPonPort),
+		options.BBSim.STag,
+		options.BBSim.CTagInit,
+		options.BBSim.EnableAuth,
+		options.BBSim.EnableDhcp,
+		options.BBSim.Delay,
 		false,
 	)
 
-	log.Debugf("Created OLT with id: %d", options.OltID)
+	log.Debugf("Created OLT with id: %d", options.Olt.ID)
 
 	sigs := make(chan os.Signal, 1)
 	// stop API servers on SIGTERM
@@ -194,7 +193,7 @@
 
 	defer func() {
 		log.Info("BroadBand Simulator is off")
-		if *options.ProfileCpu != "" {
+		if *options.BBSim.CpuProfile != "" {
 			log.Info("Stopping profiler")
 			pprof.StopCPUProfile()
 		}
diff --git a/configs/bbsim.yaml b/configs/bbsim.yaml
new file mode 100644
index 0000000..6cd3e9d
--- /dev/null
+++ b/configs/bbsim.yaml
@@ -0,0 +1,39 @@
+---
+# CLI arguments override values specified here.
+# Commented values show defaults. 
+
+# BBSim specific settings
+bbsim:
+  enable_dhcp: false
+  enable_auth: false
+  openolt_address: "0.0.0.0:50060"
+  api_address: "0.0.0.0:50070"
+  rest_api_address: "0.0.0.0:50071"
+  legacy_api_address: "0.0.0.0:50072"
+  legacy_rest_api_address: "0.0.0.0:50073"
+  # log_level: "debug" 
+  # log_caller: false
+  # delay: 200
+  # c_tag: 900
+  # s_tag: 900
+
+# OLT device settings
+olt:
+  model: "asfvolt16"
+  vendor: "BBSim"
+  hardware_version: "emulated"
+  device_serial_number: BBSM00000001
+  pon_ports: 1
+  nni_ports: 1
+  onus_per_port: 1 
+  onus_per_port: 1
+  technology: "XGS-PON"
+  id: 1                 # OLT-ID of the device
+  reboot_delay: 10      # reboot delay in seconds
+  # firmware_version: ""
+  # device_id: 0a:0a:0a:0a:0a:<id>
+
+# BBR settings
+bbr:
+  log: bbr.log
+  log_level: debug
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 2f23dde..fff0bfd 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -113,3 +113,7 @@
            Number of PON ports per OLT device to be emulated (default 1)
      -s_tag int
            S-Tag value (default 900)
+
+``BBSim`` also looks for a configuration file in ``configs/bbsim.yaml`` from which it reads a number of default settings. The command line options listed above override the corresponding coniguration file settings. A sample configuration file is given below:
+
+.. literalinclude:: ../../configs/bbsim.yaml
diff --git a/internal/bbsim/devices/device_params.go b/internal/bbsim/devices/device_params.go
deleted file mode 100644
index 77421ca..0000000
--- a/internal/bbsim/devices/device_params.go
+++ /dev/null
@@ -1,21 +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 devices
-
-const (
-	OltRebootDelay = 10
-)
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index eabbe62..f17ecd4 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -29,6 +29,7 @@
 	"github.com/looplab/fsm"
 	"github.com/opencord/bbsim/internal/bbsim/packetHandlers"
 	bbsim "github.com/opencord/bbsim/internal/bbsim/types"
+	"github.com/opencord/bbsim/internal/common"
 	omcisim "github.com/opencord/omci-sim"
 	"github.com/opencord/voltha-protos/v2/go/openolt"
 	"github.com/opencord/voltha-protos/v2/go/tech_profile"
@@ -213,7 +214,8 @@
 }
 
 func (o *OltDevice) RestartOLT() error {
-	oltLogger.Infof("Simulating OLT restart... (%ds)", OltRebootDelay)
+	rebootDelay := common.Options.Olt.OltRebootDelay
+	oltLogger.Infof("Simulating OLT restart... (%ds)", rebootDelay)
 
 	// transition internal state to disable
 	if !o.InternalState.Is("disabled") {
@@ -223,7 +225,7 @@
 		}
 	}
 
-	time.Sleep(OltRebootDelay * time.Second)
+	time.Sleep(time.Duration(rebootDelay) * time.Second)
 
 	if err := o.InternalState.Event("initialize"); err != nil {
 		log.Errorf("Error initializing OLT: %v", err)
@@ -235,8 +237,7 @@
 
 // newOltServer launches a new grpc server for OpenOLT
 func newOltServer() (*grpc.Server, error) {
-	// TODO make configurable
-	address := "0.0.0.0:50060"
+	address := common.Options.BBSim.OpenOltAddress
 	lis, err := net.Listen("tcp", address)
 	if err != nil {
 		oltLogger.Fatalf("OLT failed to listen: %v", err)
@@ -707,11 +708,11 @@
 		"PonPorts": o.NumPon,
 	}).Info("OLT receives GetDeviceInfo call from VOLTHA")
 	devinfo := new(openolt.DeviceInfo)
-	devinfo.Vendor = "BBSim"
-	devinfo.Model = "asfvolt16"
-	devinfo.HardwareVersion = "emulated"
-	devinfo.FirmwareVersion = ""
-	devinfo.Technology = "xgspon"
+	devinfo.Vendor = common.Options.Olt.Vendor
+	devinfo.Model = common.Options.Olt.Model
+	devinfo.HardwareVersion = common.Options.Olt.HardwareVersion
+	devinfo.FirmwareVersion = common.Options.Olt.FirmwareVersion
+	devinfo.Technology = common.Options.Olt.Technology
 	devinfo.PonPorts = uint32(o.NumPon)
 	devinfo.OnuIdStart = 1
 	devinfo.OnuIdEnd = 255
@@ -722,7 +723,7 @@
 	devinfo.FlowIdStart = 1
 	devinfo.FlowIdEnd = 16383
 	devinfo.DeviceSerialNumber = o.SerialNumber
-	devinfo.DeviceId = net.HardwareAddr{0xA, 0xA, 0xA, 0xA, 0xA, byte(o.ID)}.String()
+	devinfo.DeviceId = common.Options.Olt.DeviceId
 
 	return devinfo, nil
 }
diff --git a/internal/common/options.go b/internal/common/options.go
index 56acf21..954e66e 100644
--- a/internal/common/options.go
+++ b/internal/common/options.go
@@ -16,69 +16,172 @@
 
 package common
 
-import "flag"
+import (
+	"flag"
+	"fmt"
+	"io/ioutil"
+	"net"
 
-type BBSimCliOptions struct {
-	OltID        int
-	NumNniPerOlt int
-	NumPonPerOlt int
-	NumOnuPerPon int
-	STag         int
-	CTagInit     int
-	Auth         bool
-	Dhcp         bool
-	ProfileCpu   *string
-	LogLevel     string
-	LogCaller    bool
-	Delay        int
-}
+	"gopkg.in/yaml.v2"
+)
 
 type BBRCliOptions struct {
-	*BBSimCliOptions
+	*BBSimYamlConfig
 	BBSimIp      string
 	BBSimPort    string
 	BBSimApiPort string
 	LogFile      string
 }
 
-func GetBBSimOpts() *BBSimCliOptions {
+type BBSimYamlConfig struct {
+	BBSim BBSimConfig
+	Olt   OltConfig
+	BBR   BBRConfig
+}
 
-	olt_id := flag.Int("olt_id", 0, "Number of OLT devices to be emulated")
-	nni := flag.Int("nni", 1, "Number of NNI ports per OLT device to be emulated")
-	pon := flag.Int("pon", 1, "Number of PON ports per OLT device to be emulated")
-	onu := flag.Int("onu", 1, "Number of ONU devices per PON port to be emulated")
+type OltConfig struct {
+	Model              string `yaml:"model"`
+	Vendor             string `yaml:"vendor"`
+	HardwareVersion    string `yaml:"hardware_version"`
+	FirmwareVersion    string `yaml:"firmware_version"`
+	DeviceId           string `yaml:"device_id"`
+	DeviceSerialNumber string `yaml:"device_serial_number"`
+	PonPorts           uint32 `yaml:"pon_ports"`
+	NniPorts           uint32 `yaml:"nni_ports"`
+	OnusPonPort        uint32 `yaml:"onus_per_port"`
+	Technology         string `yaml:"technology"`
+	ID                 int    `yaml:"id"`
+	OltRebootDelay     int    `yaml:"reboot_delay"`
+}
 
-	auth := flag.Bool("auth", false, "Set this flag if you want authentication to start automatically")
-	dhcp := flag.Bool("dhcp", false, "Set this flag if you want DHCP to start automatically")
+type BBSimConfig struct {
+	EnableDhcp           bool    `yaml:"enable_dhcp"`
+	EnableAuth           bool    `yaml:"enable_auth"`
+	LogLevel             string  `yaml:"log_level"`
+	LogCaller            bool    `yaml:"log_caller"`
+	Delay                int     `yaml:"delay"`
+	CpuProfile           *string `yaml:"cpu_profile"`
+	CTagInit             int     `yaml:"c_tag"`
+	STag                 int     `yaml:"s_tag"`
+	OpenOltAddress       string  `yaml:"openolt_address"`
+	ApiAddress           string  `yaml:"api_address"`
+	RestApiAddress       string  `yaml:"rest_api_address"`
+	LegacyApiAddress     string  `yaml:"legacy_api_address"`
+	LegacyRestApiAddress string  `yaml:"legacy_rest_api_address"`
+}
 
-	s_tag := flag.Int("s_tag", 900, "S-Tag value")
-	c_tag_init := flag.Int("c_tag", 900, "C-Tag starting value, each ONU will get a sequential one (targeting 1024 ONUs per BBSim instance the range is big enough)")
+type BBRConfig struct {
+	Log       string `yaml:"log"`
+	LogLevel  string `yaml:"log_level"`
+	LogCaller bool   `yaml:"log_caller"`
+}
+
+var Options *BBSimYamlConfig
+
+func init() {
+	// load settings from config file first
+	Options, _ = LoadBBSimConf("configs/bbsim.yaml")
+}
+
+func getDefaultOps() *BBSimYamlConfig {
+
+	c := &BBSimYamlConfig{
+		BBSimConfig{
+			STag:                 900,
+			CTagInit:             900,
+			EnableDhcp:           false,
+			EnableAuth:           false,
+			LogLevel:             "debug",
+			LogCaller:            false,
+			Delay:                200,
+			OpenOltAddress:       "0.0.0.0:50060",
+			ApiAddress:           "0.0.0.0:50070",
+			RestApiAddress:       "0.0.0.0:50071",
+			LegacyApiAddress:     "0.0.0.0:50072",
+			LegacyRestApiAddress: "0.0.0.0:50073",
+		},
+		OltConfig{
+			Vendor:             "BBSim",
+			Model:              "asfvolt16",
+			HardwareVersion:    "emulated",
+			FirmwareVersion:    "",
+			DeviceSerialNumber: "BBSM00000001",
+			PonPorts:           1,
+			NniPorts:           1,
+			OnusPonPort:        1,
+			Technology:         "XGS-PON",
+			ID:                 0,
+			OltRebootDelay:     10,
+		},
+		BBRConfig{
+			LogLevel:  "debug",
+			LogCaller: false,
+		},
+	}
+	return c
+}
+
+// LoadBBSimConf loads the BBSim configuration from a YAML file
+func LoadBBSimConf(filename string) (*BBSimYamlConfig, error) {
+	yamlConfig := getDefaultOps()
+
+	yamlFile, err := ioutil.ReadFile(filename)
+	if err != nil {
+		fmt.Printf("Cannot load BBSim configuration file: %s. Using defaults.\n", err)
+		return yamlConfig, nil
+	}
+
+	err = yaml.Unmarshal(yamlFile, yamlConfig)
+	if err != nil {
+		fmt.Printf("Error parsing YAML file: %s\n", err)
+	}
+
+	return yamlConfig, nil
+}
+
+// GetBBSimOpts loads the BBSim configuration file and overides options with corresponding CLI flags if set
+func GetBBSimOpts() *BBSimYamlConfig {
+	conf := Options
+
+	olt_id := flag.Int("olt_id", conf.Olt.ID, "OLT device ID")
+	nni := flag.Int("nni", int(conf.Olt.NniPorts), "Number of NNI ports per OLT device to be emulated")
+	pon := flag.Int("pon", int(conf.Olt.PonPorts), "Number of PON ports per OLT device to be emulated")
+	onu := flag.Int("onu", int(conf.Olt.OnusPonPort), "Number of ONU devices per PON port to be emulated")
+
+	s_tag := flag.Int("s_tag", conf.BBSim.STag, "S-Tag initial value")
+	c_tag_init := flag.Int("c_tag", conf.BBSim.CTagInit, "C-Tag starting value, each ONU will get a sequential one (targeting 1024 ONUs per BBSim instance the range is big enough)")
+
+	auth := flag.Bool("auth", conf.BBSim.EnableAuth, "Set this flag if you want authentication to start automatically")
+	dhcp := flag.Bool("dhcp", conf.BBSim.EnableDhcp, "Set this flag if you want DHCP to start automatically")
 
 	profileCpu := flag.String("cpuprofile", "", "write cpu profile to file")
 
-	logLevel := flag.String("logLevel", "debug", "Set the log level (trace, debug, info, warn, error)")
-	logCaller := flag.Bool("logCaller", false, "Whether to print the caller filename or not")
+	logLevel := flag.String("logLevel", conf.BBSim.LogLevel, "Set the log level (trace, debug, info, warn, error)")
+	logCaller := flag.Bool("logCaller", conf.BBSim.LogCaller, "Whether to print the caller filename or not")
 
-	delay := flag.Int("delay", 200, "The delay between ONU DISCOVERY batches in milliseconds (1 ONU per each PON PORT at a time")
+	delay := flag.Int("delay", conf.BBSim.Delay, "The delay between ONU DISCOVERY batches in milliseconds (1 ONU per each PON PORT at a time")
 
 	flag.Parse()
 
-	o := new(BBSimCliOptions)
+	conf.Olt.ID = int(*olt_id)
+	conf.Olt.NniPorts = uint32(*nni)
+	conf.Olt.PonPorts = uint32(*pon)
+	conf.Olt.OnusPonPort = uint32(*onu)
+	conf.BBSim.STag = int(*s_tag)
+	conf.BBSim.CTagInit = int(*c_tag_init)
+	conf.BBSim.CpuProfile = profileCpu
+	conf.BBSim.LogLevel = *logLevel
+	conf.BBSim.LogCaller = *logCaller
+	conf.BBSim.EnableAuth = *auth
+	conf.BBSim.EnableDhcp = *dhcp
+	conf.BBSim.Delay = *delay
 
-	o.OltID = int(*olt_id)
-	o.NumNniPerOlt = int(*nni)
-	o.NumPonPerOlt = int(*pon)
-	o.NumOnuPerPon = int(*onu)
-	o.STag = int(*s_tag)
-	o.CTagInit = int(*c_tag_init)
-	o.ProfileCpu = profileCpu
-	o.LogLevel = *logLevel
-	o.LogCaller = *logCaller
-	o.Auth = *auth
-	o.Dhcp = *dhcp
-	o.Delay = *delay
+	// update device id if not set
+	if conf.Olt.DeviceId == "" {
+		conf.Olt.DeviceId = net.HardwareAddr{0xA, 0xA, 0xA, 0xA, 0xA, byte(conf.Olt.ID)}.String()
+	}
 
-	return o
+	return conf
 }
 
 func GetBBROpts() BBRCliOptions {
diff --git a/vendor/modules.txt b/vendor/modules.txt
index f014b80..5adc681 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,6 +1,6 @@
 # github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1
-github.com/aead/cmac
 github.com/aead/cmac/aes
+github.com/aead/cmac
 # github.com/cboling/omci v0.1.0
 github.com/cboling/omci
 github.com/cboling/omci/generated
@@ -12,21 +12,21 @@
 github.com/golang/glog
 # github.com/golang/protobuf v1.3.2
 github.com/golang/protobuf/descriptor
-github.com/golang/protobuf/jsonpb
 github.com/golang/protobuf/proto
 github.com/golang/protobuf/protoc-gen-go
 github.com/golang/protobuf/protoc-gen-go/descriptor
-github.com/golang/protobuf/protoc-gen-go/generator
-github.com/golang/protobuf/protoc-gen-go/generator/internal/remap
-github.com/golang/protobuf/protoc-gen-go/grpc
-github.com/golang/protobuf/protoc-gen-go/plugin
-github.com/golang/protobuf/ptypes
+github.com/golang/protobuf/jsonpb
 github.com/golang/protobuf/ptypes/any
 github.com/golang/protobuf/ptypes/duration
-github.com/golang/protobuf/ptypes/empty
-github.com/golang/protobuf/ptypes/struct
 github.com/golang/protobuf/ptypes/timestamp
 github.com/golang/protobuf/ptypes/wrappers
+github.com/golang/protobuf/ptypes
+github.com/golang/protobuf/ptypes/struct
+github.com/golang/protobuf/ptypes/empty
+github.com/golang/protobuf/protoc-gen-go/generator
+github.com/golang/protobuf/protoc-gen-go/grpc
+github.com/golang/protobuf/protoc-gen-go/plugin
+github.com/golang/protobuf/protoc-gen-go/generator/internal/remap
 # github.com/google/go-cmp v0.2.0
 github.com/google/go-cmp/cmp
 github.com/google/go-cmp/cmp/internal/diff
@@ -37,26 +37,26 @@
 github.com/google/gopacket/layers
 github.com/google/gopacket/pcap
 # github.com/grpc-ecosystem/grpc-gateway v1.11.3
-github.com/grpc-ecosystem/grpc-gateway/codegenerator
-github.com/grpc-ecosystem/grpc-gateway/internal
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger
-github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options
 github.com/grpc-ecosystem/grpc-gateway/runtime
 github.com/grpc-ecosystem/grpc-gateway/utilities
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
+github.com/grpc-ecosystem/grpc-gateway/internal
+github.com/grpc-ecosystem/grpc-gateway/codegenerator
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule
+github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator
 # github.com/jessevdk/go-flags v1.4.0
 github.com/jessevdk/go-flags
 # github.com/jhump/protoreflect v1.5.0
-github.com/jhump/protoreflect/codec
 github.com/jhump/protoreflect/desc
-github.com/jhump/protoreflect/desc/internal
 github.com/jhump/protoreflect/dynamic
+github.com/jhump/protoreflect/desc/internal
 github.com/jhump/protoreflect/internal
+github.com/jhump/protoreflect/codec
 # github.com/konsorten/go-windows-terminal-sequences v1.0.1
 github.com/konsorten/go-windows-terminal-sequences
 # github.com/looplab/fsm v0.1.0
@@ -73,38 +73,38 @@
 # github.com/sirupsen/logrus v1.4.2
 github.com/sirupsen/logrus
 # golang.org/x/net v0.0.0-20190724013045-ca1201d0de80
-golang.org/x/net/context
-golang.org/x/net/http/httpguts
+golang.org/x/net/trace
+golang.org/x/net/internal/timeseries
 golang.org/x/net/http2
 golang.org/x/net/http2/hpack
+golang.org/x/net/context
+golang.org/x/net/http/httpguts
 golang.org/x/net/idna
-golang.org/x/net/internal/timeseries
-golang.org/x/net/trace
 # golang.org/x/sys v0.0.0-20190422165155-953cdadca894
 golang.org/x/sys/unix
 # golang.org/x/text v0.3.0
 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-20190716160619-c506a9f90610
 google.golang.org/genproto/googleapis/api/annotations
 google.golang.org/genproto/googleapis/api/httpbody
-google.golang.org/genproto/googleapis/rpc/status
 google.golang.org/genproto/protobuf/field_mask
+google.golang.org/genproto/googleapis/rpc/status
 # google.golang.org/grpc v1.22.1
 google.golang.org/grpc
-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/grpclog
+google.golang.org/grpc/status
+google.golang.org/grpc/reflection
+google.golang.org/grpc/metadata
+google.golang.org/grpc/balancer
+google.golang.org/grpc/balancer/roundrobin
 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
 google.golang.org/grpc/internal
 google.golang.org/grpc/internal/backoff
 google.golang.org/grpc/internal/balancerload
@@ -113,26 +113,26 @@
 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/reflection
-google.golang.org/grpc/reflection/grpc_reflection_v1alpha
 google.golang.org/grpc/resolver
 google.golang.org/grpc/resolver/dns
 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/reflection/grpc_reflection_v1alpha
+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/yaml.v2 v2.2.2
 gopkg.in/yaml.v2
 # gotest.tools v2.2.0+incompatible
 gotest.tools/assert
 gotest.tools/assert/cmp
-gotest.tools/internal/difflib
 gotest.tools/internal/format
 gotest.tools/internal/source
+gotest.tools/internal/difflib