Merge "[VOL-2761][VOL-2905] Support for DT workflow"
diff --git a/VERSION b/VERSION
index 70426f8..0ea3a94 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.2.0-dev
+0.2.0
diff --git a/api/bbsim/bbsim.pb.go b/api/bbsim/bbsim.pb.go
index 7d3a9ee..5d4a80d 100644
--- a/api/bbsim/bbsim.pb.go
+++ b/api/bbsim/bbsim.pb.go
@@ -1079,9 +1079,7 @@
 	proto.RegisterType((*Empty)(nil), "bbsim.Empty")
 }
 
-func init() {
-	proto.RegisterFile("api/bbsim/bbsim.proto", fileDescriptor_ef7750073d18011b)
-}
+func init() { proto.RegisterFile("api/bbsim/bbsim.proto", fileDescriptor_ef7750073d18011b) }
 
 var fileDescriptor_ef7750073d18011b = []byte{
 	// 1353 bytes of a gzipped FileDescriptorProto
@@ -1184,26 +1182,47 @@
 //
 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 type BBSimClient interface {
+	// Get BBSim version
 	Version(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*VersionNumber, error)
+	// Set BBSim log level
 	SetLogLevel(ctx context.Context, in *LogLevel, opts ...grpc.CallOption) (*LogLevel, error)
+	// Get current status of OLT
 	GetOlt(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Olt, error)
+	// Poweron OLT
 	PoweronOlt(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Response, error)
+	// Shutdown OLT
 	ShutdownOlt(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Response, error)
+	// Reboot OLT
 	RebootOlt(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Response, error)
+	// Get status of an ONU by serial number
 	GetONU(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*ONU, error)
+	// Get status of all ONUs
 	GetONUs(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ONUs, error)
+	// Shutdown an ONU by serial number
 	ShutdownONU(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*Response, error)
+	// Shutdown all ONUs in OLT
 	ShutdownAllONUs(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Response, error)
+	// Shutdown all ONUs under a PON by pon-port-ID
 	ShutdownONUsOnPON(ctx context.Context, in *PONRequest, opts ...grpc.CallOption) (*Response, error)
+	// Poweron an ONU by serial number
 	PoweronONU(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*Response, error)
+	// Poweron all ONUs in OLT
 	PoweronAllONUs(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Response, error)
+	// Poweron all ONUs under a PON by pon-port-ID
 	PoweronONUsOnPON(ctx context.Context, in *PONRequest, opts ...grpc.CallOption) (*Response, error)
+	// Restart EAPOL for ONU
 	RestartEapol(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*Response, error)
+	// Resatrt DHCP for ONU
 	RestartDhcp(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*Response, error)
+	// Send ONU alarm indication
 	SetOnuAlarmIndication(ctx context.Context, in *ONUAlarmRequest, opts ...grpc.CallOption) (*Response, error)
+	// Send OLT alarm indication for Interface type NNI or PON
 	SetOltAlarmIndication(ctx context.Context, in *OLTAlarmRequest, opts ...grpc.CallOption) (*Response, error)
+	// Get all flows or ONU specific flows
 	GetFlows(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*Flows, error)
+	// Chnage IGMP state
 	ChangeIgmpState(ctx context.Context, in *IgmpRequest, opts ...grpc.CallOption) (*Response, error)
+	// Get Traffic scheduler information for ONU
 	GetOnuTrafficSchedulers(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*ONUTrafficSchedulers, error)
 }
 
@@ -1406,26 +1425,47 @@
 
 // BBSimServer is the server API for BBSim service.
 type BBSimServer interface {
+	// Get BBSim version
 	Version(context.Context, *Empty) (*VersionNumber, error)
+	// Set BBSim log level
 	SetLogLevel(context.Context, *LogLevel) (*LogLevel, error)
+	// Get current status of OLT
 	GetOlt(context.Context, *Empty) (*Olt, error)
+	// Poweron OLT
 	PoweronOlt(context.Context, *Empty) (*Response, error)
+	// Shutdown OLT
 	ShutdownOlt(context.Context, *Empty) (*Response, error)
+	// Reboot OLT
 	RebootOlt(context.Context, *Empty) (*Response, error)
+	// Get status of an ONU by serial number
 	GetONU(context.Context, *ONURequest) (*ONU, error)
+	// Get status of all ONUs
 	GetONUs(context.Context, *Empty) (*ONUs, error)
+	// Shutdown an ONU by serial number
 	ShutdownONU(context.Context, *ONURequest) (*Response, error)
+	// Shutdown all ONUs in OLT
 	ShutdownAllONUs(context.Context, *Empty) (*Response, error)
+	// Shutdown all ONUs under a PON by pon-port-ID
 	ShutdownONUsOnPON(context.Context, *PONRequest) (*Response, error)
+	// Poweron an ONU by serial number
 	PoweronONU(context.Context, *ONURequest) (*Response, error)
+	// Poweron all ONUs in OLT
 	PoweronAllONUs(context.Context, *Empty) (*Response, error)
+	// Poweron all ONUs under a PON by pon-port-ID
 	PoweronONUsOnPON(context.Context, *PONRequest) (*Response, error)
+	// Restart EAPOL for ONU
 	RestartEapol(context.Context, *ONURequest) (*Response, error)
+	// Resatrt DHCP for ONU
 	RestartDhcp(context.Context, *ONURequest) (*Response, error)
+	// Send ONU alarm indication
 	SetOnuAlarmIndication(context.Context, *ONUAlarmRequest) (*Response, error)
+	// Send OLT alarm indication for Interface type NNI or PON
 	SetOltAlarmIndication(context.Context, *OLTAlarmRequest) (*Response, error)
+	// Get all flows or ONU specific flows
 	GetFlows(context.Context, *ONURequest) (*Flows, error)
+	// Chnage IGMP state
 	ChangeIgmpState(context.Context, *IgmpRequest) (*Response, error)
+	// Get Traffic scheduler information for ONU
 	GetOnuTrafficSchedulers(context.Context, *ONURequest) (*ONUTrafficSchedulers, error)
 }
 
diff --git a/api/legacy/bbsim.pb.go b/api/legacy/bbsim.pb.go
index d54276c..060760b 100644
--- a/api/legacy/bbsim.pb.go
+++ b/api/legacy/bbsim.pb.go
@@ -895,60 +895,42 @@
 
 // Reference imports to suppress errors if they are not otherwise used.
 var _ context.Context
-var _ grpc.ClientConnInterface
+var _ grpc.ClientConn
 
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion6
+const _ = grpc.SupportPackageIsVersion4
 
 // BBSimServiceClient is the client API for BBSimService service.
 //
 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 type BBSimServiceClient interface {
 	// Get current status of OLT
-	//
-	// Deprecated: Do not use.
 	OLTStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*OLTStatusResponse, error)
 	// Get status of a PON/NNI port
-	//
-	// Deprecated: Do not use.
 	PortStatus(ctx context.Context, in *PortInfo, opts ...grpc.CallOption) (*Ports, error)
 	// Get status of all or specific ONUs
-	//
-	// Deprecated: Do not use.
 	ONUStatus(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*ONUs, error)
 	// Single/bulk activate ONU(s) for specific PON port(s)
-	//
-	// Deprecated: Do not use.
 	ONUActivate(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*BBSimResponse, error)
 	// Deactivate ONU(s) for specific PON port(s) specified by
 	// a given onu_serial, onu_id, or pon_port_id
-	//
-	// Deprecated: Do not use.
 	ONUDeactivate(ctx context.Context, in *ONURequest, opts ...grpc.CallOption) (*BBSimResponse, error)
 	// Generate ONU related alarms
-	//
-	// Deprecated: Do not use.
 	GenerateONUAlarm(ctx context.Context, in *ONUAlarmRequest, opts ...grpc.CallOption) (*BBSimResponse, error)
 	// Generate OLT related alarms
-	//
-	// Deprecated: Do not use.
 	GenerateOLTAlarm(ctx context.Context, in *OLTAlarmRequest, opts ...grpc.CallOption) (*BBSimResponse, error)
 	// Perform actions on OLT/ONU devices (e.g. reboot)
-	//
-	// Deprecated: Do not use.
 	PerformDeviceAction(ctx context.Context, in *DeviceAction, opts ...grpc.CallOption) (*BBSimResponse, error)
 	// Get flows
-	//
-	// Deprecated: Do not use.
 	GetFlows(ctx context.Context, in *ONUInfo, opts ...grpc.CallOption) (*Flows, error)
 }
 
 type bBSimServiceClient struct {
-	cc grpc.ClientConnInterface
+	cc *grpc.ClientConn
 }
 
-func NewBBSimServiceClient(cc grpc.ClientConnInterface) BBSimServiceClient {
+func NewBBSimServiceClient(cc *grpc.ClientConn) BBSimServiceClient {
 	return &bBSimServiceClient{cc}
 }
 
@@ -1045,41 +1027,23 @@
 // BBSimServiceServer is the server API for BBSimService service.
 type BBSimServiceServer interface {
 	// Get current status of OLT
-	//
-	// Deprecated: Do not use.
 	OLTStatus(context.Context, *Empty) (*OLTStatusResponse, error)
 	// Get status of a PON/NNI port
-	//
-	// Deprecated: Do not use.
 	PortStatus(context.Context, *PortInfo) (*Ports, error)
 	// Get status of all or specific ONUs
-	//
-	// Deprecated: Do not use.
 	ONUStatus(context.Context, *ONURequest) (*ONUs, error)
 	// Single/bulk activate ONU(s) for specific PON port(s)
-	//
-	// Deprecated: Do not use.
 	ONUActivate(context.Context, *ONURequest) (*BBSimResponse, error)
 	// Deactivate ONU(s) for specific PON port(s) specified by
 	// a given onu_serial, onu_id, or pon_port_id
-	//
-	// Deprecated: Do not use.
 	ONUDeactivate(context.Context, *ONURequest) (*BBSimResponse, error)
 	// Generate ONU related alarms
-	//
-	// Deprecated: Do not use.
 	GenerateONUAlarm(context.Context, *ONUAlarmRequest) (*BBSimResponse, error)
 	// Generate OLT related alarms
-	//
-	// Deprecated: Do not use.
 	GenerateOLTAlarm(context.Context, *OLTAlarmRequest) (*BBSimResponse, error)
 	// Perform actions on OLT/ONU devices (e.g. reboot)
-	//
-	// Deprecated: Do not use.
 	PerformDeviceAction(context.Context, *DeviceAction) (*BBSimResponse, error)
 	// Get flows
-	//
-	// Deprecated: Do not use.
 	GetFlows(context.Context, *ONUInfo) (*Flows, error)
 }
 
diff --git a/cmd/bbsim/bbsim.go b/cmd/bbsim/bbsim.go
index 8a1b088..6a4c6e9 100644
--- a/cmd/bbsim/bbsim.go
+++ b/cmd/bbsim/bbsim.go
@@ -157,6 +157,11 @@
 		"Events":               options.BBSim.Events,
 		"ControlledActivation": options.BBSim.ControlledActivation,
 		"EnablePerf":           options.BBSim.EnablePerf,
+		"CTag":                 options.BBSim.CTag,
+		"CTagAllocation":       options.BBSim.CTagAllocation,
+		"STag":                 options.BBSim.STag,
+		"STagAllocation":       options.BBSim.STagAllocation,
+		"SadisFormat":          options.BBSim.SadisFormat,
 	}).Info("BroadBand Simulator is on")
 
 	// control channels, they are only closed when the goroutine needs to be terminated
diff --git a/configs/bbsim.yaml b/configs/bbsim.yaml
index 23a6cc9..3e3587f 100644
--- a/configs/bbsim.yaml
+++ b/configs/bbsim.yaml
@@ -14,12 +14,15 @@
   # legacy_api_address: ":50072"
   # legacy_rest_api_address: ":50073"
   # sadis_rest_address: ":50074"
+  # sadis_format: att|dt|tt
   # enable_events: false
   # kafka_address: ":9092"
   # log_level: "debug" 
   # log_caller: false
   # delay: 200
+  # c_tag_allocation: unique
   # c_tag: 900
+  # s_tag_allocation: shared
   # s_tag: 900
 
 # OLT device settings
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 960d4bf..b3ea17b 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -93,16 +93,28 @@
 
    $ ./bbsim --help
    Usage of ./bbsim:
+     -api_address string
+           IP address:port (default ":50070")
      -auth
            Set this flag if you want authentication to start automatically
      -c_tag int
            C-Tag starting value, each ONU will get a sequential one (targeting 1024 ONUs per BBSim instance the range is big enough) (default 900)
+     -c_tag_allocation string
+           Use 'unique' for incremental values, 'shared' to use the same value in all the ONUs (default "unique")
+     -ca string
+           Set the mode for controlled activation of PON ports and ONUs (default "default")
      -cpuprofile string
            write cpu profile to file
      -delay int
            The delay between ONU DISCOVERY batches in milliseconds (1 ONU per each PON PORT at a time (default 200)
      -dhcp
            Set this flag if you want DHCP to start automatically
+     -enableEvents
+           Enable sending BBSim events on configured kafka server
+     -enableperf
+           Setting this flag will cause BBSim to not store data like traffic schedulers, flows of ONUs etc..
+     -kafkaAddress string
+           IP:Port for kafka (default ":9092")
      -logCaller
            Whether to print the caller filename or not
      -logLevel string
@@ -110,21 +122,21 @@
      -nni int
            Number of NNI ports per OLT device to be emulated (default 1)
      -olt_id int
-           Number of OLT devices to be emulated
+           OLT device ID
      -onu int
            Number of ONU devices per PON port to be emulated (default 1)
+     -openolt_address string
+           IP address:port (default ":50060")
      -pon int
            Number of PON ports per OLT device to be emulated (default 1)
+     -rest_api_address string
+           IP address:port (default ":50071")
      -s_tag int
-           S-Tag value (default 900)
-     -enableEvents
-           Set this flag for publishing BBSim events on configured kafkaAddress
-     -kafkaAddress string
-           IP:Port for kafka, used only when bbsimEvents flag is set (default ":9092")
-     -ca string
-           Set the mode for controlled activation of PON ports and ONUs
-     -enableperf bool
-           Setting this flag will cause BBSim to not store data like traffic schedulers, flows of ONUs etc
+           S-Tag initial value (default 900)
+     -s_tag_allocation string
+           Use 'unique' for incremental values, 'shared' to use the same value in all the ONUs (default "shared")
+     -sadisFormat string
+           Which format should sadis expose? [att|dt|tt] (default "att")
 
 ``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
@@ -133,6 +145,37 @@
 
 .. literalinclude:: ../../configs/bbsim.yaml
 
+Specifying different tagging schemes
+------------------------------------
+
+BBSim supports two different tagging schemes:
+- ``-s_tag_allocation shared -c_tag_allocation unique``
+- ``-s_tag_allocation unique -c_tag_allocation shared``
+
+Where the former will use the same ``S-Tag`` for all the ONUs and a unique ``C-Tag`` for each of them
+and the latter will use a unique ``S-Tag`` for each ONU and the same ``C-Tag`` for all of them.
+
+For example:
+
+.. code:: bash
+
+   # -s_tag_allocation shared -c_tag_allocation unique
+   PONPORTID    ID    PORTNO    SERIALNUMBER    HWADDRESS            STAG    CTAG    OPERSTATE    INTERNALSTATE
+   0            0     0         BBSM00000001    2e:60:70:00:00:01    900     900     down         created
+   1            0     0         BBSM00000101    2e:60:70:00:01:01    900     901     down         created
+   2            0     0         BBSM00000201    2e:60:70:00:02:01    900     902     down         created
+   3            0     0         BBSM00000301    2e:60:70:00:03:01    900     903     down         created
+
+
+   # -s_tag_allocation unique -c_tag_allocation shared
+   PONPORTID    ID    PORTNO    SERIALNUMBER    HWADDRESS            STAG    CTAG    OPERSTATE    INTERNALSTATE
+   0            0     0         BBSM00000001    2e:60:70:00:00:01    900     7       down         created
+   1            0     0         BBSM00000101    2e:60:70:00:01:01    901     7       down         created
+   2            0     0         BBSM00000201    2e:60:70:00:02:01    902     7       down         created
+   3            0     0         BBSM00000301    2e:60:70:00:03:01    903     7       down         created
+
+
+
 Using the BBSim Sadis server in ONOS
 ------------------------------------
 
@@ -143,14 +186,14 @@
 To configure ONOS to use the BBSim ``Sadis`` server endpoints, the Sadis app
 must use be configured as follows (see ``examples/sadis-in-bbsim.json``):
 
-.. literalinclude:: ../../examples/sadis-in-bbsim2.json
+.. literalinclude:: ../../examples/sadis-in-bbsim.json
 
 This base configuration may also be obtained directly from the BBSim Sadis
 server:
 
 .. code:: bash
 
-   curl http://<BBSIM_IP>:50074/cfg -o examples/sadis.json
+   curl http://<BBSIM_IP>:50074/v2/cfg -o examples/sadis.json
 
 It can then be pushed to the Sadis app using the following command:
 
@@ -170,10 +213,69 @@
 
 In ONOS subscriber information can be queried using ``sadis <id>``.
 
-*Note that BBSim supports both sadis configuration versions, here is an example of the configuration needed to return
-the old format:*
+*Note that BBSim supports both sadis configuration versions,
+if you need to support the configuration for release older than VOLTHA-2.3
+you can use the following command:*
 
-.. literalinclude:: ../../examples/sadis-in-bbsim.json
+.. code:: bash
+
+   curl http://<BBSIM_IP>:50074/v1/cfg -o examples/sadis.json
+
+Configure the Sadis format for different workflows
+**************************************************
+
+BBSim support different sadis formats, required for different workflows.
+The desired sadis format can be specified via the ``-sadisFormat`` flag.
+
+The difference in the format is restricted to the ``uniTagList`` property,
+for example:
+
+**ATT**
+
+.. code:: json
+
+   {
+  "id": "BBSM00000003-1",
+  "nasPortId": "BBSM00000003-1",
+  "circuitId": "BBSM00000003-1",
+  "remoteId": "BBSM00000003-1",
+  "uniTagList": [
+    {
+      "DownstreamBandwidthProfile": "User_Bandwidth1",
+      "IsDhcpRequired": true,
+      "IsIgmpRequired": true,
+      "PonCTag": 903,
+      "PonSTag": 900,
+      "TechnologyProfileID": 64,
+      "UpstreamBandwidthProfile": "Default"
+    }
+  ]
+}
+
+**DT**
+
+.. code:: json
+
+   {
+  "id": "BBSM00000003-1",
+  "nasPortId": "BBSM00000003-1",
+  "circuitId": "BBSM00000003-1",
+  "remoteId": "BBSM00000003-1",
+  "uniTagList": [
+    {
+      "DownstreamBandwidthProfile": "User_Bandwidth1",
+      "PonCTag": 4096,
+      "PonSTag": 903,
+      "TechnologyProfileID": 64,
+      "UniTagMatch": 4096,
+      "UpstreamBandwidthProfile": "Default"
+    }
+  ]
+}
+
+**TT**
+
+*Coming soon...*
 
 Controlled PON and ONU activation
 ---------------------------------
diff --git a/examples/sadis-in-bbsim.json b/examples/sadis-in-bbsim.json
index c016e82..1e972ce 100644
--- a/examples/sadis-in-bbsim.json
+++ b/examples/sadis-in-bbsim.json
@@ -1,17 +1,26 @@
 {
   "sadis": {
     "integration": {
-      "url": "http://bbsim.voltha.svc:50074/v1/subscribers/%s",
+      "url": "http://bbsim:50074/v2/subscribers/%s",
       "cache": {
-        "enabled": true,
+        "enabled": false,
         "maxsize": 50,
-        "ttl": "PT1m"
+        "ttl": "PT0m"
       }
-    }
+    },
+    "entries": [
+      {
+        "id": "BBSIM_OLT_0",
+        "hardwareIdentifier": "0a:0a:0a:0a:0a:00",
+        "ipAddress": "0.0.0.0",
+        "nasId": "BBSIM_OLT_0",
+        "uplinkPort": 1048576
+      }
+    ]
   },
   "bandwidthprofile": {
     "integration": {
-      "url": "http://bbsim.voltha.svc:50074/v1/bandwidthprofiles/%s",
+      "url": "http://bbsim:50074/v2/bandwidthprofiles/%s",
       "cache": {
         "enabled": true,
         "maxsize": 40,
diff --git a/examples/sadis-in-bbsim2.json b/examples/sadis-in-bbsim2.json
deleted file mode 100644
index b0fcc91..0000000
--- a/examples/sadis-in-bbsim2.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
-  "sadis": {
-    "integration": {
-      "url": "http://bbsim.voltha.svc:50074/v2/subscribers/%s",
-      "cache": {
-        "enabled": true,
-        "maxsize": 50,
-        "ttl": "PT1m"
-      }
-    }
-  },
-  "bandwidthprofile": {
-    "integration": {
-      "url": "http://bbsim.voltha.svc:50074/v2/bandwidthprofiles/%s",
-      "cache": {
-        "enabled": true,
-        "maxsize": 40,
-        "ttl": "PT1m"
-      }
-    }
-  }
-}
diff --git a/examples/sadis-minimal-voltha-1.json b/examples/sadis-minimal-voltha-1.json
deleted file mode 100644
index 259d3c4..0000000
--- a/examples/sadis-minimal-voltha-1.json
+++ /dev/null
@@ -1,91 +0,0 @@
-{
-  "org.opencord.sadis": {
-    "sadis": {
-      "integration": {
-        "cache": {
-          "enabled": true,
-          "maxsize": 50,
-          "ttl": "PT1m"
-        }
-      },
-      "entries": [
-        {
-          "id": "BBSM00000001",
-          "cTag": 900,
-          "sTag": 900,
-          "nasPortId": "BBSM00000001",
-          "technologyProfileId": 64,
-          "upstreamBandwidthProfile": "High-Speed-Internet",
-          "downstreamBandwidthProfile": "User1-Specific"
-        },
-        {
-          "id": "BBSM00000002",
-          "cTag": 901,
-          "sTag": 900,
-          "nasPortId": "BBSM00000002",
-          "technologyProfileId": 64,
-          "upstreamBandwidthProfile": "High-Speed-Internet",
-          "downstreamBandwidthProfile": "User1-Specific"
-        },
-        {
-          "id": "BBSM00000101",
-          "cTag": 902,
-          "sTag": 900,
-          "nasPortId": "BBSM00000101",
-          "technologyProfileId": 64,
-          "upstreamBandwidthProfile": "High-Speed-Internet",
-          "downstreamBandwidthProfile": "User1-Specific"
-        },
-        {
-          "id": "BBSM00000102",
-          "cTag": 903,
-          "sTag": 900,
-          "nasPortId": "BBSM00000102",
-          "technologyProfileId": 64,
-          "upstreamBandwidthProfile": "High-Speed-Internet",
-          "downstreamBandwidthProfile": "User1-Specific"
-        },
-        {
-          "id": "BBSIM_OLT_0",
-          "hardwareIdentifier": "00:1b:22:00:b1:78",
-          "ipAddress": "192.168.1.252",
-          "uplinkPort": 65536,
-          "nasId": "BBSIM_OLT_0"
-        }
-      ]
-    },
-    "bandwidthprofile": {
-      "integration": {
-        "cache": {
-          "enabled": true,
-          "maxsize": 40,
-          "ttl": "PT1m"
-        }
-      },
-      "entries": [
-        {
-          "id": "High-Speed-Internet",
-          "cir": 600,
-          "cbs": 2000,
-          "eir": 5000,
-          "ebs": 2000,
-          "air": 100000
-        }, {
-          "id": "User1-Specific",
-          "cir": 600,
-          "cbs": 3000,
-          "eir": 3000,
-          "ebs": 4000,
-          "air": 100000
-        }, {
-          "id": "Default",
-          "cir": 600,
-          "cbs": 30,
-          "eir": 400,
-          "ebs": 30,
-          "air": 100000
-        }
-      ]
-    }
-  }
-}
\ No newline at end of file
diff --git a/examples/sadis-minimal-voltha-2.json b/examples/sadis-minimal-voltha-2.json
deleted file mode 100644
index 5c20625..0000000
--- a/examples/sadis-minimal-voltha-2.json
+++ /dev/null
@@ -1,91 +0,0 @@
-{
-  "org.opencord.sadis": {
-    "sadis": {
-      "integration": {
-        "cache": {
-          "enabled": true,
-          "maxsize": 50,
-          "ttl": "PT1m"
-        }
-      },
-      "entries": [
-        {
-          "id": "BBSM00000001-1",
-          "cTag": 900,
-          "sTag": 900,
-          "nasPortId": "BBSM00000001",
-          "technologyProfileId": 64,
-          "upstreamBandwidthProfile": "High-Speed-Internet",
-          "downstreamBandwidthProfile": "User1-Specific"
-        },
-        {
-          "id": "BBSM00000002-1",
-          "cTag": 901,
-          "sTag": 900,
-          "nasPortId": "BBSM00000002",
-          "technologyProfileId": 64,
-          "upstreamBandwidthProfile": "High-Speed-Internet",
-          "downstreamBandwidthProfile": "User1-Specific"
-        },
-        {
-          "id": "BBSM00000101-1",
-          "cTag": 902,
-          "sTag": 900,
-          "nasPortId": "BBSM00000101",
-          "technologyProfileId": 64,
-          "upstreamBandwidthProfile": "High-Speed-Internet",
-          "downstreamBandwidthProfile": "User1-Specific"
-        },
-        {
-          "id": "BBSM00000102-1",
-          "cTag": 903,
-          "sTag": 900,
-          "nasPortId": "BBSM00000102",
-          "technologyProfileId": 64,
-          "upstreamBandwidthProfile": "High-Speed-Internet",
-          "downstreamBandwidthProfile": "User1-Specific"
-        },
-        {
-          "id": "BBSIM_OLT_0",
-          "hardwareIdentifier": "00:1b:22:00:b1:78",
-          "ipAddress": "192.168.1.252",
-          "uplinkPort": 65536,
-          "nasId": "BBSIM_OLT_0"
-        }
-      ]
-    },
-    "bandwidthprofile": {
-      "integration": {
-        "cache": {
-          "enabled": true,
-          "maxsize": 40,
-          "ttl": "PT1m"
-        }
-      },
-      "entries": [
-        {
-          "id": "High-Speed-Internet",
-          "cir": 600,
-          "cbs": 2000,
-          "eir": 5000,
-          "ebs": 2000,
-          "air": 100000
-        }, {
-          "id": "User1-Specific",
-          "cir": 600,
-          "cbs": 3000,
-          "eir": 3000,
-          "ebs": 4000,
-          "air": 100000
-        }, {
-          "id": "Default",
-          "cir": 600,
-          "cbs": 30,
-          "eir": 400,
-          "ebs": 30,
-          "air": 100000
-        }
-      ]
-    }
-  }
-}
\ No newline at end of file
diff --git a/go.mod b/go.mod
index 27a7e19..7784d8c 100644
--- a/go.mod
+++ b/go.mod
@@ -7,6 +7,8 @@
 	github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1 // indirect
 	github.com/cboling/omci v0.1.0
 	github.com/deckarep/golang-set v1.7.1 // indirect
+	github.com/fatih/structs v1.1.0
+	github.com/ghodss/yaml v1.0.0
 	github.com/golang/protobuf v1.3.2
 	github.com/google/gopacket v1.1.17
 	github.com/gorilla/mux v1.7.3
@@ -20,6 +22,7 @@
 	github.com/opencord/voltha-protos/v2 v2.1.2
 	github.com/pkg/errors v0.8.1 // indirect
 	github.com/sirupsen/logrus v1.4.2
+	golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135
 	google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c
 	google.golang.org/grpc v1.27.0
 	gopkg.in/yaml.v2 v2.2.8
diff --git a/go.sum b/go.sum
index fde3757..e8349ed 100644
--- a/go.sum
+++ b/go.sum
@@ -24,6 +24,8 @@
 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
 github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
 github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
+github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
 github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
 github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
 github.com/frankban/quicktest v1.7.2 h1:2QxQoC1TS09S7fhCPsrvqYdvP1H5M1P1ih5ABm3BTYk=
@@ -137,6 +139,7 @@
 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A=
 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index 0d64a14..28ac5a1 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -33,7 +33,7 @@
 	"github.com/opencord/bbsim/internal/common"
 	omcisim "github.com/opencord/omci-sim"
 	"github.com/opencord/voltha-protos/v2/go/openolt"
-	tech_profile "github.com/opencord/voltha-protos/v2/go/tech_profile"
+	"github.com/opencord/voltha-protos/v2/go/tech_profile"
 	log "github.com/sirupsen/logrus"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
@@ -148,19 +148,43 @@
 	}
 
 	// create PON ports
-	availableCTag := options.BBSim.CTagInit
-	for i := 0; i < olt.NumPon; i++ {
-		p := CreatePonPort(&olt, uint32(i))
 
-		// create ONU devices
-		for j := 0; j < olt.NumOnuPerPon; j++ {
-			delay := time.Duration(olt.Delay*j) * time.Millisecond
-			o := CreateONU(&olt, *p, uint32(j+1), options.BBSim.STag, availableCTag, options.BBSim.EnableAuth, options.BBSim.EnableDhcp, delay, isMock)
-			p.Onus = append(p.Onus, o)
-			availableCTag = availableCTag + 1
+	if options.BBSim.STagAllocation == common.TagAllocationShared && options.BBSim.CTagAllocation == common.TagAllocationShared {
+		oltLogger.Fatalf("This configuration will result in duplicate C/S tags combination")
+	} else if options.BBSim.STagAllocation == common.TagAllocationUnique && options.BBSim.CTagAllocation == common.TagAllocationUnique {
+		oltLogger.Fatalf("This configuration is not supported yet")
+	} else if options.BBSim.STagAllocation == common.TagAllocationShared && options.BBSim.CTagAllocation == common.TagAllocationUnique {
+		// ATT case
+		availableCTag := options.BBSim.CTag
+		for i := 0; i < olt.NumPon; i++ {
+			p := CreatePonPort(&olt, uint32(i))
+
+			// create ONU devices
+			for j := 0; j < olt.NumOnuPerPon; j++ {
+				delay := time.Duration(olt.Delay*j) * time.Millisecond
+				o := CreateONU(&olt, *p, uint32(j+1), options.BBSim.STag, availableCTag, options.BBSim.EnableAuth, options.BBSim.EnableDhcp, delay, isMock)
+				p.Onus = append(p.Onus, o)
+				availableCTag = availableCTag + 1
+			}
+
+			olt.Pons = append(olt.Pons, p)
 		}
+	} else if options.BBSim.STagAllocation == common.TagAllocationUnique && options.BBSim.CTagAllocation == common.TagAllocationShared {
+		// DT case
+		availableSTag := options.BBSim.STag
+		for i := 0; i < olt.NumPon; i++ {
+			p := CreatePonPort(&olt, uint32(i))
 
-		olt.Pons = append(olt.Pons, p)
+			// create ONU devices
+			for j := 0; j < olt.NumOnuPerPon; j++ {
+				delay := time.Duration(olt.Delay*j) * time.Millisecond
+				o := CreateONU(&olt, *p, uint32(j+1), availableSTag, options.BBSim.CTag, options.BBSim.EnableAuth, options.BBSim.EnableDhcp, delay, isMock)
+				p.Onus = append(p.Onus, o)
+				availableSTag = availableSTag + 1
+			}
+
+			olt.Pons = append(olt.Pons, p)
+		}
 	}
 
 	if isMock != true {
@@ -1069,7 +1093,7 @@
 	pon, err := o.GetPonById(omci_msg.IntfId)
 	if err != nil {
 		oltLogger.WithFields(log.Fields{
-			"error": err,
+			"error":  err,
 			"onu_id": omci_msg.OnuId,
 			"pon_id": omci_msg.IntfId,
 		}).Error("pon ID not found")
@@ -1079,7 +1103,7 @@
 	onu, err := pon.GetOnuById(omci_msg.OnuId)
 	if err != nil {
 		oltLogger.WithFields(log.Fields{
-			"error": err,
+			"error":  err,
 			"onu_id": omci_msg.OnuId,
 			"pon_id": omci_msg.IntfId,
 		}).Error("onu ID not found")
diff --git a/internal/bbsim/responders/sadis/sadis.go b/internal/bbsim/responders/sadis/sadis.go
index d24daeb..fc2b451 100644
--- a/internal/bbsim/responders/sadis/sadis.go
+++ b/internal/bbsim/responders/sadis/sadis.go
@@ -93,10 +93,10 @@
 	NasPortID  string        `json:"nasPortId"`
 	CircuitID  string        `json:"circuitId"`
 	RemoteID   string        `json:"remoteId"`
-	UniTagList []SadisUniTag `json:"uniTagList"`
+	UniTagList []interface{} `json:"uniTagList"` // this can be SadisUniTagAtt, SadisUniTagDt
 }
 
-type SadisUniTag struct {
+type SadisUniTagAtt struct {
 	PonCTag                    int    `json:"ponCTag, omitempty"`
 	PonSTag                    int    `json:"ponSTag, omitempty"`
 	TechnologyProfileID        int    `json:"technologyProfileId, omitempty"`
@@ -106,6 +106,15 @@
 	IsIgmpRequired             bool   `json:"isIgmpRequired, omitempty"`
 }
 
+type SadisUniTagDt struct {
+	UniTagMatch                int    `json:"uniTagMatch, omitempty"`
+	PonCTag                    int    `json:"ponCTag, omitempty"`
+	PonSTag                    int    `json:"ponSTag, omitempty"`
+	TechnologyProfileID        int    `json:"technologyProfileId, omitempty"`
+	UpstreamBandwidthProfile   string `json:"upstreamBandwidthProfile, omitempty"`
+	DownstreamBandwidthProfile string `json:"downstreamBandwidthProfile, omitempty"`
+}
+
 // SADIS BandwithProfile Entry
 type SadisBWPEntry struct {
 	ID  string `json:"id"`
@@ -189,18 +198,34 @@
 		RemoteID:  onu.Sn() + uniSuffix,
 	}
 
-	// TODO this sadis config only works for the ATT workflow
-	// address VOL-2761 to support DT
-	sonuUniTag := SadisUniTag{
-		PonCTag:             onu.CTag,
-		PonSTag:             onu.STag,
-		TechnologyProfileID: 64,
-		// NOTE do we want to select a random bandwidth profile?
-		// if so use bandwidthProfiles[rand.Intn(len(bandwidthProfiles))].ID
-		UpstreamBandwidthProfile:   "Default",
-		DownstreamBandwidthProfile: "User_Bandwidth1",
-		IsDhcpRequired:             true,
-		IsIgmpRequired:             true,
+	// base structure common to all use cases
+	var sonuUniTag interface{}
+
+	// set workflow specific params
+	switch common.Options.BBSim.SadisFormat {
+	case common.SadisFormatAtt:
+		sonuUniTag = SadisUniTagAtt{
+			PonCTag:             onu.CTag,
+			PonSTag:             onu.STag,
+			TechnologyProfileID: 64,
+			// NOTE do we want to select a random bandwidth profile?
+			// if so use bandwidthProfiles[rand.Intn(len(bandwidthProfiles))].ID
+			UpstreamBandwidthProfile:   "Default",
+			DownstreamBandwidthProfile: "User_Bandwidth1",
+			IsDhcpRequired:             true,
+			IsIgmpRequired:             true,
+		}
+	case common.SadisFormatDt:
+		sonuUniTag = SadisUniTagDt{
+			PonCTag:             4096,
+			PonSTag:             onu.STag,
+			TechnologyProfileID: 64,
+			// NOTE do we want to select a random bandwidth profile?
+			// if so use bandwidthProfiles[rand.Intn(len(bandwidthProfiles))].ID
+			UpstreamBandwidthProfile:   "Default",
+			DownstreamBandwidthProfile: "User_Bandwidth1",
+			UniTagMatch:                4096,
+		}
 	}
 
 	sonuv2.UniTagList = append(sonuv2.UniTagList, sonuUniTag)
diff --git a/internal/bbsim/responders/sadis/sadis_test.go b/internal/bbsim/responders/sadis/sadis_test.go
new file mode 100644
index 0000000..7c8bc1b
--- /dev/null
+++ b/internal/bbsim/responders/sadis/sadis_test.go
@@ -0,0 +1,121 @@
+/*
+ * 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 sadis
+
+import (
+	"fmt"
+	"github.com/opencord/bbsim/internal/bbsim/devices"
+	"github.com/opencord/bbsim/internal/common"
+	"gotest.tools/assert"
+	"net"
+	"testing"
+)
+
+func createMockDevices() (devices.OltDevice, devices.Onu) {
+	olt := devices.OltDevice{
+		ID: 0,
+	}
+
+	onu := devices.Onu{
+		ID:        1,
+		PonPortID: 1,
+		STag:      900,
+		CTag:      923,
+		HwAddress: net.HardwareAddr{0x2e, 0x60, 0x70, 0x13, byte(1), byte(1)},
+		PortNo:    0,
+	}
+	onu.SerialNumber = onu.NewSN(0, onu.PonPortID, onu.ID)
+
+	return olt, onu
+}
+
+func TestSadisServer_GetOnuEntryV1(t *testing.T) {
+
+	olt, onu := createMockDevices()
+
+	uni := "1"
+
+	res, err := GetOnuEntryV1(&olt, &onu, uni)
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	assert.Equal(t, res.ID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
+	assert.Equal(t, res.CTag, 923)
+	assert.Equal(t, res.STag, 900)
+	assert.Equal(t, res.RemoteID, string(olt.SerialNumber))
+	assert.Equal(t, res.DownstreamBandwidthProfile, "Default")
+	assert.Equal(t, res.UpstreamBandwidthProfile, "User_Bandwidth1")
+	assert.Equal(t, res.TechnologyProfileID, 64)
+
+}
+
+func TestSadisServer_GetOnuEntryV2_Att(t *testing.T) {
+	olt, onu := createMockDevices()
+
+	uni := "1"
+
+	res, err := GetOnuEntryV2(&olt, &onu, uni)
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	assert.Equal(t, res.ID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
+	assert.Equal(t, res.RemoteID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
+
+	// assert the correct type
+	uniTagList, ok := res.UniTagList[0].(SadisUniTagAtt)
+	if !ok {
+		t.Fatal("UniTagList has the wrong type")
+	}
+
+	assert.Equal(t, uniTagList.PonCTag, 923)
+	assert.Equal(t, uniTagList.PonSTag, 900)
+	assert.Equal(t, uniTagList.DownstreamBandwidthProfile, "User_Bandwidth1")
+	assert.Equal(t, uniTagList.UpstreamBandwidthProfile, "Default")
+	assert.Equal(t, uniTagList.TechnologyProfileID, 64)
+	assert.Equal(t, uniTagList.IsDhcpRequired, true)
+	assert.Equal(t, uniTagList.IsIgmpRequired, true)
+}
+
+func TestSadisServer_GetOnuEntryV2_Dt(t *testing.T) {
+	common.Options.BBSim.SadisFormat = common.SadisFormatDt
+	olt, onu := createMockDevices()
+
+	uni := "1"
+
+	res, err := GetOnuEntryV2(&olt, &onu, uni)
+	if err != nil {
+		t.Fatal(err)
+	}
+
+	assert.Equal(t, res.ID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
+	assert.Equal(t, res.RemoteID, fmt.Sprintf("%s-%s",onu.Sn(), uni))
+
+	// assert the correct type
+	uniTagList, ok := res.UniTagList[0].(SadisUniTagDt)
+	if !ok {
+		t.Fatal("UniTagList has the wrong type")
+	}
+
+	assert.Equal(t, uniTagList.PonCTag, 4096)
+	assert.Equal(t, uniTagList.PonSTag, 900)
+	assert.Equal(t, uniTagList.DownstreamBandwidthProfile, "User_Bandwidth1")
+	assert.Equal(t, uniTagList.UpstreamBandwidthProfile, "Default")
+	assert.Equal(t, uniTagList.TechnologyProfileID, 64)
+	assert.Equal(t, uniTagList.UniTagMatch, 4096)
+}
\ No newline at end of file
diff --git a/internal/common/options.go b/internal/common/options.go
index d7bc9eb..6088a1d 100644
--- a/internal/common/options.go
+++ b/internal/common/options.go
@@ -17,12 +17,77 @@
 package common
 
 import (
+	"errors"
 	"flag"
 	"fmt"
+	"github.com/ghodss/yaml"
 	"io/ioutil"
+	log "github.com/sirupsen/logrus"
 	"net"
+	"strings"
+)
 
-	"gopkg.in/yaml.v2"
+var tagAllocationValues = []string{
+	"unknown",
+	"shared",
+	"unique",
+}
+
+type TagAllocation int
+
+func (t TagAllocation) String() string {
+	return tagAllocationValues[t]
+}
+
+func tagAllocationFromString(s string) (TagAllocation, error) {
+	for i, v := range tagAllocationValues {
+		if v == s {
+			return TagAllocation(i), nil
+		}
+	}
+	log.WithFields(log.Fields{
+		"ValidValues": strings.Join(tagAllocationValues[1:], ", "),
+	}).Errorf("%s-is-not-a-valid-tag-allocation", s)
+	return TagAllocation(0), errors.New(fmt.Sprintf("%s-is-not-a-valid-tag-allocation", s))
+}
+
+const (
+	_ TagAllocation = iota
+	TagAllocationShared
+	TagAllocationUnique
+)
+
+
+var sadisFormatValues = []string{
+	"unknown",
+	"att",
+	"dt",
+	"tt",
+}
+
+type SadisFormat int
+
+func (s SadisFormat) String() string {
+	return sadisFormatValues[s]
+}
+
+func sadisFormatFromString(s string) (SadisFormat, error) {
+	for i, v := range sadisFormatValues {
+		if v == s {
+			return SadisFormat(i), nil
+		}
+	}
+	log.WithFields(log.Fields{
+		"ValidValues": strings.Join(sadisFormatValues[1:], ", "),
+	}).Errorf("%s-is-not-a-valid-sadis-format", s)
+	return SadisFormat(0), errors.New(fmt.Sprintf("%s-is-not-a-valid-sadis-format", s))
+}
+
+const (
+	_ SadisFormat = iota
+	SadisFormatAtt
+	SadisFormatDt
+	SadisFormatTt
 )
 
 type BBRCliOptions struct {
@@ -56,25 +121,28 @@
 }
 
 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"`
-	SadisRestAddress     string  `yaml:"sadis_rest_address"`
-	SadisServer          bool    `yaml:"sadis_server"`
-	KafkaAddress         string  `yaml:"kafka_address"`
-	Events               bool    `yaml:"enable_events"`
-	ControlledActivation string  `yaml:"controlled_activation"`
-	EnablePerf           bool    `yaml:"enable_perf"`
+	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"`
+	CTagAllocation       TagAllocation `yaml:"c_tag_allocation"`
+	CTag                 int           `yaml:"c_tag"`
+	STagAllocation       TagAllocation `yaml:"s_tag_allocation"`
+	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"`
+	SadisRestAddress     string        `yaml:"sadis_rest_address"`
+	SadisServer          bool          `yaml:"sadis_server"`
+	SadisFormat          SadisFormat   `yaml:"sadis_format"`
+	KafkaAddress         string        `yaml:"kafka_address"`
+	Events               bool          `yaml:"enable_events"`
+	ControlledActivation string        `yaml:"controlled_activation"`
+	EnablePerf           bool          `yaml:"enable_perf"`
 }
 
 type BBRConfig struct {
@@ -94,8 +162,10 @@
 
 	c := &BBSimYamlConfig{
 		BBSimConfig{
+			STagAllocation:       TagAllocationShared,
 			STag:                 900,
-			CTagInit:             900,
+			CTagAllocation:       TagAllocationUnique,
+			CTag:                 900,
 			EnableDhcp:           false,
 			EnableAuth:           false,
 			LogLevel:             "debug",
@@ -108,6 +178,7 @@
 			LegacyRestApiAddress: ":50073",
 			SadisRestAddress:     ":50074",
 			SadisServer:          true,
+			SadisFormat:          SadisFormatAtt,
 			KafkaAddress:         ":9092",
 			Events:               false,
 			ControlledActivation: "default",
@@ -150,6 +221,8 @@
 		fmt.Printf("Error parsing YAML file: %s\n", err)
 	}
 
+	// TODO convert from string to TagAllocation
+
 	return yamlConfig, nil
 }
 
@@ -166,8 +239,13 @@
 	api_address := flag.String("api_address", conf.BBSim.ApiAddress, "IP address:port")
 	rest_api_address := flag.String("rest_api_address", conf.BBSim.RestApiAddress, "IP address:port")
 
+	s_tag_allocation := flag.String("s_tag_allocation", conf.BBSim.STagAllocation.String(), "Use 'unique' for incremental values, 'shared' to use the same value in all the ONUs")
 	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)")
+
+	c_tag_allocation := flag.String("c_tag_allocation", conf.BBSim.CTagAllocation.String(), "Use 'unique' for incremental values, 'shared' to use the same value in all the ONUs")
+	c_tag := flag.Int("c_tag", conf.BBSim.CTag, "C-Tag starting value, each ONU will get a sequential one (targeting 1024 ONUs per BBSim instance the range is big enough)")
+
+	sadisFormat := flag.String("sadisFormat", conf.BBSim.SadisFormat.String(), fmt.Sprintf("Which format should sadis expose? [%s]", strings.Join(sadisFormatValues[1:], "|")))
 
 	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")
@@ -185,12 +263,33 @@
 	kafkaAddress := flag.String("kafkaAddress", conf.BBSim.KafkaAddress, "IP:Port for kafka")
 	flag.Parse()
 
+	sTagAlloc, err := tagAllocationFromString(*s_tag_allocation)
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	cTagAlloc, err := tagAllocationFromString(*c_tag_allocation)
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	sf, err := sadisFormatFromString(*sadisFormat)
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	if sf == SadisFormatTt {
+		log.Fatalf("Sadis format %s is not yet supported", sf.String())
+	}
+
 	conf.Olt.ID = int(*olt_id)
 	conf.Olt.NniPorts = uint32(*nni)
 	conf.Olt.PonPorts = uint32(*pon)
 	conf.Olt.OnusPonPort = uint32(*onu)
+	conf.BBSim.STagAllocation = sTagAlloc
 	conf.BBSim.STag = int(*s_tag)
-	conf.BBSim.CTagInit = int(*c_tag_init)
+	conf.BBSim.CTagAllocation = cTagAlloc
+	conf.BBSim.CTag = int(*c_tag)
 	conf.BBSim.CpuProfile = profileCpu
 	conf.BBSim.LogLevel = *logLevel
 	conf.BBSim.LogCaller = *logCaller
@@ -204,6 +303,7 @@
 	conf.BBSim.OpenOltAddress = *openolt_address
 	conf.BBSim.ApiAddress = *api_address
 	conf.BBSim.RestApiAddress = *rest_api_address
+	conf.BBSim.SadisFormat = sf
 
 	// update device id if not set
 	if conf.Olt.DeviceId == "" {
diff --git a/vendor/github.com/fatih/structs/.gitignore b/vendor/github.com/fatih/structs/.gitignore
new file mode 100644
index 0000000..8365624
--- /dev/null
+++ b/vendor/github.com/fatih/structs/.gitignore
@@ -0,0 +1,23 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
diff --git a/vendor/github.com/fatih/structs/.travis.yml b/vendor/github.com/fatih/structs/.travis.yml
new file mode 100644
index 0000000..a08df79
--- /dev/null
+++ b/vendor/github.com/fatih/structs/.travis.yml
@@ -0,0 +1,13 @@
+language: go
+go: 
+ - 1.7.x
+ - 1.8.x
+ - 1.9.x
+ - tip
+sudo: false
+before_install:
+- go get github.com/axw/gocov/gocov
+- go get github.com/mattn/goveralls
+- if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
+script:
+- $HOME/gopath/bin/goveralls -service=travis-ci
diff --git a/vendor/github.com/fatih/structs/LICENSE b/vendor/github.com/fatih/structs/LICENSE
new file mode 100644
index 0000000..34504e4
--- /dev/null
+++ b/vendor/github.com/fatih/structs/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Fatih Arslan
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/fatih/structs/README.md b/vendor/github.com/fatih/structs/README.md
new file mode 100644
index 0000000..a75eabf
--- /dev/null
+++ b/vendor/github.com/fatih/structs/README.md
@@ -0,0 +1,163 @@
+# Structs [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/fatih/structs) [![Build Status](http://img.shields.io/travis/fatih/structs.svg?style=flat-square)](https://travis-ci.org/fatih/structs) [![Coverage Status](http://img.shields.io/coveralls/fatih/structs.svg?style=flat-square)](https://coveralls.io/r/fatih/structs)
+
+Structs contains various utilities to work with Go (Golang) structs. It was
+initially used by me to convert a struct into a `map[string]interface{}`. With
+time I've added other utilities for structs.  It's basically a high level
+package based on primitives from the reflect package. Feel free to add new
+functions or improve the existing code.
+
+## Install
+
+```bash
+go get github.com/fatih/structs
+```
+
+## Usage and Examples
+
+Just like the standard lib `strings`, `bytes` and co packages, `structs` has
+many global functions to manipulate or organize your struct data. Lets define
+and declare a struct:
+
+```go
+type Server struct {
+	Name        string `json:"name,omitempty"`
+	ID          int
+	Enabled     bool
+	users       []string // not exported
+	http.Server          // embedded
+}
+
+server := &Server{
+	Name:    "gopher",
+	ID:      123456,
+	Enabled: true,
+}
+```
+
+```go
+// Convert a struct to a map[string]interface{}
+// => {"Name":"gopher", "ID":123456, "Enabled":true}
+m := structs.Map(server)
+
+// Convert the values of a struct to a []interface{}
+// => ["gopher", 123456, true]
+v := structs.Values(server)
+
+// Convert the names of a struct to a []string
+// (see "Names methods" for more info about fields)
+n := structs.Names(server)
+
+// Convert the values of a struct to a []*Field
+// (see "Field methods" for more info about fields)
+f := structs.Fields(server)
+
+// Return the struct name => "Server"
+n := structs.Name(server)
+
+// Check if any field of a struct is initialized or not.
+h := structs.HasZero(server)
+
+// Check if all fields of a struct is initialized or not.
+z := structs.IsZero(server)
+
+// Check if server is a struct or a pointer to struct
+i := structs.IsStruct(server)
+```
+
+### Struct methods
+
+The structs functions can be also used as independent methods by creating a new
+`*structs.Struct`. This is handy if you want to have more control over the
+structs (such as retrieving a single Field).
+
+```go
+// Create a new struct type:
+s := structs.New(server)
+
+m := s.Map()              // Get a map[string]interface{}
+v := s.Values()           // Get a []interface{}
+f := s.Fields()           // Get a []*Field
+n := s.Names()            // Get a []string
+f := s.Field(name)        // Get a *Field based on the given field name
+f, ok := s.FieldOk(name)  // Get a *Field based on the given field name
+n := s.Name()             // Get the struct name
+h := s.HasZero()          // Check if any field is uninitialized
+z := s.IsZero()           // Check if all fields are uninitialized
+```
+
+### Field methods
+
+We can easily examine a single Field for more detail. Below you can see how we
+get and interact with various field methods:
+
+
+```go
+s := structs.New(server)
+
+// Get the Field struct for the "Name" field
+name := s.Field("Name")
+
+// Get the underlying value,  value => "gopher"
+value := name.Value().(string)
+
+// Set the field's value
+name.Set("another gopher")
+
+// Get the field's kind, kind =>  "string"
+name.Kind()
+
+// Check if the field is exported or not
+if name.IsExported() {
+	fmt.Println("Name field is exported")
+}
+
+// Check if the value is a zero value, such as "" for string, 0 for int
+if !name.IsZero() {
+	fmt.Println("Name is initialized")
+}
+
+// Check if the field is an anonymous (embedded) field
+if !name.IsEmbedded() {
+	fmt.Println("Name is not an embedded field")
+}
+
+// Get the Field's tag value for tag name "json", tag value => "name,omitempty"
+tagValue := name.Tag("json")
+```
+
+Nested structs are supported too:
+
+```go
+addrField := s.Field("Server").Field("Addr")
+
+// Get the value for addr
+a := addrField.Value().(string)
+
+// Or get all fields
+httpServer := s.Field("Server").Fields()
+```
+
+We can also get a slice of Fields from the Struct type to iterate over all
+fields. This is handy if you wish to examine all fields:
+
+```go
+s := structs.New(server)
+
+for _, f := range s.Fields() {
+	fmt.Printf("field name: %+v\n", f.Name())
+
+	if f.IsExported() {
+		fmt.Printf("value   : %+v\n", f.Value())
+		fmt.Printf("is zero : %+v\n", f.IsZero())
+	}
+}
+```
+
+## Credits
+
+ * [Fatih Arslan](https://github.com/fatih)
+ * [Cihangir Savas](https://github.com/cihangir)
+
+## License
+
+The MIT License (MIT) - see LICENSE.md for more details
diff --git a/vendor/github.com/fatih/structs/field.go b/vendor/github.com/fatih/structs/field.go
new file mode 100644
index 0000000..e697832
--- /dev/null
+++ b/vendor/github.com/fatih/structs/field.go
@@ -0,0 +1,141 @@
+package structs
+
+import (
+	"errors"
+	"fmt"
+	"reflect"
+)
+
+var (
+	errNotExported = errors.New("field is not exported")
+	errNotSettable = errors.New("field is not settable")
+)
+
+// Field represents a single struct field that encapsulates high level
+// functions around the field.
+type Field struct {
+	value      reflect.Value
+	field      reflect.StructField
+	defaultTag string
+}
+
+// Tag returns the value associated with key in the tag string. If there is no
+// such key in the tag, Tag returns the empty string.
+func (f *Field) Tag(key string) string {
+	return f.field.Tag.Get(key)
+}
+
+// Value returns the underlying value of the field. It panics if the field
+// is not exported.
+func (f *Field) Value() interface{} {
+	return f.value.Interface()
+}
+
+// IsEmbedded returns true if the given field is an anonymous field (embedded)
+func (f *Field) IsEmbedded() bool {
+	return f.field.Anonymous
+}
+
+// IsExported returns true if the given field is exported.
+func (f *Field) IsExported() bool {
+	return f.field.PkgPath == ""
+}
+
+// IsZero returns true if the given field is not initialized (has a zero value).
+// It panics if the field is not exported.
+func (f *Field) IsZero() bool {
+	zero := reflect.Zero(f.value.Type()).Interface()
+	current := f.Value()
+
+	return reflect.DeepEqual(current, zero)
+}
+
+// Name returns the name of the given field
+func (f *Field) Name() string {
+	return f.field.Name
+}
+
+// Kind returns the fields kind, such as "string", "map", "bool", etc ..
+func (f *Field) Kind() reflect.Kind {
+	return f.value.Kind()
+}
+
+// Set sets the field to given value v. It returns an error if the field is not
+// settable (not addressable or not exported) or if the given value's type
+// doesn't match the fields type.
+func (f *Field) Set(val interface{}) error {
+	// we can't set unexported fields, so be sure this field is exported
+	if !f.IsExported() {
+		return errNotExported
+	}
+
+	// do we get here? not sure...
+	if !f.value.CanSet() {
+		return errNotSettable
+	}
+
+	given := reflect.ValueOf(val)
+
+	if f.value.Kind() != given.Kind() {
+		return fmt.Errorf("wrong kind. got: %s want: %s", given.Kind(), f.value.Kind())
+	}
+
+	f.value.Set(given)
+	return nil
+}
+
+// Zero sets the field to its zero value. It returns an error if the field is not
+// settable (not addressable or not exported).
+func (f *Field) Zero() error {
+	zero := reflect.Zero(f.value.Type()).Interface()
+	return f.Set(zero)
+}
+
+// Fields returns a slice of Fields. This is particular handy to get the fields
+// of a nested struct . A struct tag with the content of "-" ignores the
+// checking of that particular field. Example:
+//
+//   // Field is ignored by this package.
+//   Field *http.Request `structs:"-"`
+//
+// It panics if field is not exported or if field's kind is not struct
+func (f *Field) Fields() []*Field {
+	return getFields(f.value, f.defaultTag)
+}
+
+// Field returns the field from a nested struct. It panics if the nested struct
+// is not exported or if the field was not found.
+func (f *Field) Field(name string) *Field {
+	field, ok := f.FieldOk(name)
+	if !ok {
+		panic("field not found")
+	}
+
+	return field
+}
+
+// FieldOk returns the field from a nested struct. The boolean returns whether
+// the field was found (true) or not (false).
+func (f *Field) FieldOk(name string) (*Field, bool) {
+	value := &f.value
+	// value must be settable so we need to make sure it holds the address of the
+	// variable and not a copy, so we can pass the pointer to strctVal instead of a
+	// copy (which is not assigned to any variable, hence not settable).
+	// see "https://blog.golang.org/laws-of-reflection#TOC_8."
+	if f.value.Kind() != reflect.Ptr {
+		a := f.value.Addr()
+		value = &a
+	}
+	v := strctVal(value.Interface())
+	t := v.Type()
+
+	field, ok := t.FieldByName(name)
+	if !ok {
+		return nil, false
+	}
+
+	return &Field{
+		field: field,
+		value: v.FieldByName(name),
+	}, true
+}
diff --git a/vendor/github.com/fatih/structs/structs.go b/vendor/github.com/fatih/structs/structs.go
new file mode 100644
index 0000000..3a87706
--- /dev/null
+++ b/vendor/github.com/fatih/structs/structs.go
@@ -0,0 +1,584 @@
+// Package structs contains various utilities functions to work with structs.
+package structs
+
+import (
+	"fmt"
+
+	"reflect"
+)
+
+var (
+	// DefaultTagName is the default tag name for struct fields which provides
+	// a more granular to tweak certain structs. Lookup the necessary functions
+	// for more info.
+	DefaultTagName = "structs" // struct's field default tag name
+)
+
+// Struct encapsulates a struct type to provide several high level functions
+// around the struct.
+type Struct struct {
+	raw     interface{}
+	value   reflect.Value
+	TagName string
+}
+
+// New returns a new *Struct with the struct s. It panics if the s's kind is
+// not struct.
+func New(s interface{}) *Struct {
+	return &Struct{
+		raw:     s,
+		value:   strctVal(s),
+		TagName: DefaultTagName,
+	}
+}
+
+// Map converts the given struct to a map[string]interface{}, where the keys
+// of the map are the field names and the values of the map the associated
+// values of the fields. The default key string is the struct field name but
+// can be changed in the struct field's tag value. The "structs" key in the
+// struct's field tag value is the key name. Example:
+//
+//   // Field appears in map as key "myName".
+//   Name string `structs:"myName"`
+//
+// A tag value with the content of "-" ignores that particular field. Example:
+//
+//   // Field is ignored by this package.
+//   Field bool `structs:"-"`
+//
+// A tag value with the content of "string" uses the stringer to get the value. Example:
+//
+//   // The value will be output of Animal's String() func.
+//   // Map will panic if Animal does not implement String().
+//   Field *Animal `structs:"field,string"`
+//
+// A tag value with the option of "flatten" used in a struct field is to flatten its fields
+// in the output map. Example:
+//
+//   // The FieldStruct's fields will be flattened into the output map.
+//   FieldStruct time.Time `structs:",flatten"`
+//
+// A tag value with the option of "omitnested" stops iterating further if the type
+// is a struct. Example:
+//
+//   // Field is not processed further by this package.
+//   Field time.Time     `structs:"myName,omitnested"`
+//   Field *http.Request `structs:",omitnested"`
+//
+// A tag value with the option of "omitempty" ignores that particular field if
+// the field value is empty. Example:
+//
+//   // Field appears in map as key "myName", but the field is
+//   // skipped if empty.
+//   Field string `structs:"myName,omitempty"`
+//
+//   // Field appears in map as key "Field" (the default), but
+//   // the field is skipped if empty.
+//   Field string `structs:",omitempty"`
+//
+// Note that only exported fields of a struct can be accessed, non exported
+// fields will be neglected.
+func (s *Struct) Map() map[string]interface{} {
+	out := make(map[string]interface{})
+	s.FillMap(out)
+	return out
+}
+
+// FillMap is the same as Map. Instead of returning the output, it fills the
+// given map.
+func (s *Struct) FillMap(out map[string]interface{}) {
+	if out == nil {
+		return
+	}
+
+	fields := s.structFields()
+
+	for _, field := range fields {
+		name := field.Name
+		val := s.value.FieldByName(name)
+		isSubStruct := false
+		var finalVal interface{}
+
+		tagName, tagOpts := parseTag(field.Tag.Get(s.TagName))
+		if tagName != "" {
+			name = tagName
+		}
+
+		// if the value is a zero value and the field is marked as omitempty do
+		// not include
+		if tagOpts.Has("omitempty") {
+			zero := reflect.Zero(val.Type()).Interface()
+			current := val.Interface()
+
+			if reflect.DeepEqual(current, zero) {
+				continue
+			}
+		}
+
+		if !tagOpts.Has("omitnested") {
+			finalVal = s.nested(val)
+
+			v := reflect.ValueOf(val.Interface())
+			if v.Kind() == reflect.Ptr {
+				v = v.Elem()
+			}
+
+			switch v.Kind() {
+			case reflect.Map, reflect.Struct:
+				isSubStruct = true
+			}
+		} else {
+			finalVal = val.Interface()
+		}
+
+		if tagOpts.Has("string") {
+			s, ok := val.Interface().(fmt.Stringer)
+			if ok {
+				out[name] = s.String()
+			}
+			continue
+		}
+
+		if isSubStruct && (tagOpts.Has("flatten")) {
+			for k := range finalVal.(map[string]interface{}) {
+				out[k] = finalVal.(map[string]interface{})[k]
+			}
+		} else {
+			out[name] = finalVal
+		}
+	}
+}
+
+// Values converts the given s struct's field values to a []interface{}.  A
+// struct tag with the content of "-" ignores the that particular field.
+// Example:
+//
+//   // Field is ignored by this package.
+//   Field int `structs:"-"`
+//
+// A value with the option of "omitnested" stops iterating further if the type
+// is a struct. Example:
+//
+//   // Fields is not processed further by this package.
+//   Field time.Time     `structs:",omitnested"`
+//   Field *http.Request `structs:",omitnested"`
+//
+// A tag value with the option of "omitempty" ignores that particular field and
+// is not added to the values if the field value is empty. Example:
+//
+//   // Field is skipped if empty
+//   Field string `structs:",omitempty"`
+//
+// Note that only exported fields of a struct can be accessed, non exported
+// fields  will be neglected.
+func (s *Struct) Values() []interface{} {
+	fields := s.structFields()
+
+	var t []interface{}
+
+	for _, field := range fields {
+		val := s.value.FieldByName(field.Name)
+
+		_, tagOpts := parseTag(field.Tag.Get(s.TagName))
+
+		// if the value is a zero value and the field is marked as omitempty do
+		// not include
+		if tagOpts.Has("omitempty") {
+			zero := reflect.Zero(val.Type()).Interface()
+			current := val.Interface()
+
+			if reflect.DeepEqual(current, zero) {
+				continue
+			}
+		}
+
+		if tagOpts.Has("string") {
+			s, ok := val.Interface().(fmt.Stringer)
+			if ok {
+				t = append(t, s.String())
+			}
+			continue
+		}
+
+		if IsStruct(val.Interface()) && !tagOpts.Has("omitnested") {
+			// look out for embedded structs, and convert them to a
+			// []interface{} to be added to the final values slice
+			t = append(t, Values(val.Interface())...)
+		} else {
+			t = append(t, val.Interface())
+		}
+	}
+
+	return t
+}
+
+// Fields returns a slice of Fields. A struct tag with the content of "-"
+// ignores the checking of that particular field. Example:
+//
+//   // Field is ignored by this package.
+//   Field bool `structs:"-"`
+//
+// It panics if s's kind is not struct.
+func (s *Struct) Fields() []*Field {
+	return getFields(s.value, s.TagName)
+}
+
+// Names returns a slice of field names. A struct tag with the content of "-"
+// ignores the checking of that particular field. Example:
+//
+//   // Field is ignored by this package.
+//   Field bool `structs:"-"`
+//
+// It panics if s's kind is not struct.
+func (s *Struct) Names() []string {
+	fields := getFields(s.value, s.TagName)
+
+	names := make([]string, len(fields))
+
+	for i, field := range fields {
+		names[i] = field.Name()
+	}
+
+	return names
+}
+
+func getFields(v reflect.Value, tagName string) []*Field {
+	if v.Kind() == reflect.Ptr {
+		v = v.Elem()
+	}
+
+	t := v.Type()
+
+	var fields []*Field
+
+	for i := 0; i < t.NumField(); i++ {
+		field := t.Field(i)
+
+		if tag := field.Tag.Get(tagName); tag == "-" {
+			continue
+		}
+
+		f := &Field{
+			field: field,
+			value: v.FieldByName(field.Name),
+		}
+
+		fields = append(fields, f)
+
+	}
+
+	return fields
+}
+
+// Field returns a new Field struct that provides several high level functions
+// around a single struct field entity. It panics if the field is not found.
+func (s *Struct) Field(name string) *Field {
+	f, ok := s.FieldOk(name)
+	if !ok {
+		panic("field not found")
+	}
+
+	return f
+}
+
+// FieldOk returns a new Field struct that provides several high level functions
+// around a single struct field entity. The boolean returns true if the field
+// was found.
+func (s *Struct) FieldOk(name string) (*Field, bool) {
+	t := s.value.Type()
+
+	field, ok := t.FieldByName(name)
+	if !ok {
+		return nil, false
+	}
+
+	return &Field{
+		field:      field,
+		value:      s.value.FieldByName(name),
+		defaultTag: s.TagName,
+	}, true
+}
+
+// IsZero returns true if all fields in a struct is a zero value (not
+// initialized) A struct tag with the content of "-" ignores the checking of
+// that particular field. Example:
+//
+//   // Field is ignored by this package.
+//   Field bool `structs:"-"`
+//
+// A value with the option of "omitnested" stops iterating further if the type
+// is a struct. Example:
+//
+//   // Field is not processed further by this package.
+//   Field time.Time     `structs:"myName,omitnested"`
+//   Field *http.Request `structs:",omitnested"`
+//
+// Note that only exported fields of a struct can be accessed, non exported
+// fields  will be neglected. It panics if s's kind is not struct.
+func (s *Struct) IsZero() bool {
+	fields := s.structFields()
+
+	for _, field := range fields {
+		val := s.value.FieldByName(field.Name)
+
+		_, tagOpts := parseTag(field.Tag.Get(s.TagName))
+
+		if IsStruct(val.Interface()) && !tagOpts.Has("omitnested") {
+			ok := IsZero(val.Interface())
+			if !ok {
+				return false
+			}
+
+			continue
+		}
+
+		// zero value of the given field, such as "" for string, 0 for int
+		zero := reflect.Zero(val.Type()).Interface()
+
+		//  current value of the given field
+		current := val.Interface()
+
+		if !reflect.DeepEqual(current, zero) {
+			return false
+		}
+	}
+
+	return true
+}
+
+// HasZero returns true if a field in a struct is not initialized (zero value).
+// A struct tag with the content of "-" ignores the checking of that particular
+// field. Example:
+//
+//   // Field is ignored by this package.
+//   Field bool `structs:"-"`
+//
+// A value with the option of "omitnested" stops iterating further if the type
+// is a struct. Example:
+//
+//   // Field is not processed further by this package.
+//   Field time.Time     `structs:"myName,omitnested"`
+//   Field *http.Request `structs:",omitnested"`
+//
+// Note that only exported fields of a struct can be accessed, non exported
+// fields  will be neglected. It panics if s's kind is not struct.
+func (s *Struct) HasZero() bool {
+	fields := s.structFields()
+
+	for _, field := range fields {
+		val := s.value.FieldByName(field.Name)
+
+		_, tagOpts := parseTag(field.Tag.Get(s.TagName))
+
+		if IsStruct(val.Interface()) && !tagOpts.Has("omitnested") {
+			ok := HasZero(val.Interface())
+			if ok {
+				return true
+			}
+
+			continue
+		}
+
+		// zero value of the given field, such as "" for string, 0 for int
+		zero := reflect.Zero(val.Type()).Interface()
+
+		//  current value of the given field
+		current := val.Interface()
+
+		if reflect.DeepEqual(current, zero) {
+			return true
+		}
+	}
+
+	return false
+}
+
+// Name returns the structs's type name within its package. For more info refer
+// to Name() function.
+func (s *Struct) Name() string {
+	return s.value.Type().Name()
+}
+
+// structFields returns the exported struct fields for a given s struct. This
+// is a convenient helper method to avoid duplicate code in some of the
+// functions.
+func (s *Struct) structFields() []reflect.StructField {
+	t := s.value.Type()
+
+	var f []reflect.StructField
+
+	for i := 0; i < t.NumField(); i++ {
+		field := t.Field(i)
+		// we can't access the value of unexported fields
+		if field.PkgPath != "" {
+			continue
+		}
+
+		// don't check if it's omitted
+		if tag := field.Tag.Get(s.TagName); tag == "-" {
+			continue
+		}
+
+		f = append(f, field)
+	}
+
+	return f
+}
+
+func strctVal(s interface{}) reflect.Value {
+	v := reflect.ValueOf(s)
+
+	// if pointer get the underlying element≤
+	for v.Kind() == reflect.Ptr {
+		v = v.Elem()
+	}
+
+	if v.Kind() != reflect.Struct {
+		panic("not struct")
+	}
+
+	return v
+}
+
+// Map converts the given struct to a map[string]interface{}. For more info
+// refer to Struct types Map() method. It panics if s's kind is not struct.
+func Map(s interface{}) map[string]interface{} {
+	return New(s).Map()
+}
+
+// FillMap is the same as Map. Instead of returning the output, it fills the
+// given map.
+func FillMap(s interface{}, out map[string]interface{}) {
+	New(s).FillMap(out)
+}
+
+// Values converts the given struct to a []interface{}. For more info refer to
+// Struct types Values() method.  It panics if s's kind is not struct.
+func Values(s interface{}) []interface{} {
+	return New(s).Values()
+}
+
+// Fields returns a slice of *Field. For more info refer to Struct types
+// Fields() method.  It panics if s's kind is not struct.
+func Fields(s interface{}) []*Field {
+	return New(s).Fields()
+}
+
+// Names returns a slice of field names. For more info refer to Struct types
+// Names() method.  It panics if s's kind is not struct.
+func Names(s interface{}) []string {
+	return New(s).Names()
+}
+
+// IsZero returns true if all fields is equal to a zero value. For more info
+// refer to Struct types IsZero() method.  It panics if s's kind is not struct.
+func IsZero(s interface{}) bool {
+	return New(s).IsZero()
+}
+
+// HasZero returns true if any field is equal to a zero value. For more info
+// refer to Struct types HasZero() method.  It panics if s's kind is not struct.
+func HasZero(s interface{}) bool {
+	return New(s).HasZero()
+}
+
+// IsStruct returns true if the given variable is a struct or a pointer to
+// struct.
+func IsStruct(s interface{}) bool {
+	v := reflect.ValueOf(s)
+	if v.Kind() == reflect.Ptr {
+		v = v.Elem()
+	}
+
+	// uninitialized zero value of a struct
+	if v.Kind() == reflect.Invalid {
+		return false
+	}
+
+	return v.Kind() == reflect.Struct
+}
+
+// Name returns the structs's type name within its package. It returns an
+// empty string for unnamed types. It panics if s's kind is not struct.
+func Name(s interface{}) string {
+	return New(s).Name()
+}
+
+// nested retrieves recursively all types for the given value and returns the
+// nested value.
+func (s *Struct) nested(val reflect.Value) interface{} {
+	var finalVal interface{}
+
+	v := reflect.ValueOf(val.Interface())
+	if v.Kind() == reflect.Ptr {
+		v = v.Elem()
+	}
+
+	switch v.Kind() {
+	case reflect.Struct:
+		n := New(val.Interface())
+		n.TagName = s.TagName
+		m := n.Map()
+
+		// do not add the converted value if there are no exported fields, ie:
+		// time.Time
+		if len(m) == 0 {
+			finalVal = val.Interface()
+		} else {
+			finalVal = m
+		}
+	case reflect.Map:
+		// get the element type of the map
+		mapElem := val.Type()
+		switch val.Type().Kind() {
+		case reflect.Ptr, reflect.Array, reflect.Map,
+			reflect.Slice, reflect.Chan:
+			mapElem = val.Type().Elem()
+			if mapElem.Kind() == reflect.Ptr {
+				mapElem = mapElem.Elem()
+			}
+		}
+
+		// only iterate over struct types, ie: map[string]StructType,
+		// map[string][]StructType,
+		if mapElem.Kind() == reflect.Struct ||
+			(mapElem.Kind() == reflect.Slice &&
+				mapElem.Elem().Kind() == reflect.Struct) {
+			m := make(map[string]interface{}, val.Len())
+			for _, k := range val.MapKeys() {
+				m[k.String()] = s.nested(val.MapIndex(k))
+			}
+			finalVal = m
+			break
+		}
+
+		// TODO(arslan): should this be optional?
+		finalVal = val.Interface()
+	case reflect.Slice, reflect.Array:
+		if val.Type().Kind() == reflect.Interface {
+			finalVal = val.Interface()
+			break
+		}
+
+		// TODO(arslan): should this be optional?
+		// do not iterate of non struct types, just pass the value. Ie: []int,
+		// []string, co... We only iterate further if it's a struct.
+		// i.e []foo or []*foo
+		if val.Type().Elem().Kind() != reflect.Struct &&
+			!(val.Type().Elem().Kind() == reflect.Ptr &&
+				val.Type().Elem().Elem().Kind() == reflect.Struct) {
+			finalVal = val.Interface()
+			break
+		}
+
+		slices := make([]interface{}, val.Len())
+		for x := 0; x < val.Len(); x++ {
+			slices[x] = s.nested(val.Index(x))
+		}
+		finalVal = slices
+	default:
+		finalVal = val.Interface()
+	}
+
+	return finalVal
+}
diff --git a/vendor/github.com/fatih/structs/tags.go b/vendor/github.com/fatih/structs/tags.go
new file mode 100644
index 0000000..136a31e
--- /dev/null
+++ b/vendor/github.com/fatih/structs/tags.go
@@ -0,0 +1,32 @@
+package structs
+
+import "strings"
+
+// tagOptions contains a slice of tag options
+type tagOptions []string
+
+// Has returns true if the given option is available in tagOptions
+func (t tagOptions) Has(opt string) bool {
+	for _, tagOpt := range t {
+		if tagOpt == opt {
+			return true
+		}
+	}
+
+	return false
+}
+
+// parseTag splits a struct field's tag into its name and a list of options
+// which comes after a name. A tag is in the form of: "name,option1,option2".
+// The name can be neglectected.
+func parseTag(tag string) (string, tagOptions) {
+	// tag is one of followings:
+	// ""
+	// "name"
+	// "name,opt"
+	// "name,opt,opt2"
+	// ",opt"
+
+	res := strings.Split(tag, ",")
+	return res[0], res[1:]
+}
diff --git a/vendor/github.com/ghodss/yaml/.gitignore b/vendor/github.com/ghodss/yaml/.gitignore
new file mode 100644
index 0000000..e256a31
--- /dev/null
+++ b/vendor/github.com/ghodss/yaml/.gitignore
@@ -0,0 +1,20 @@
+# OSX leaves these everywhere on SMB shares
+._*
+
+# Eclipse files
+.classpath
+.project
+.settings/**
+
+# Emacs save files
+*~
+
+# Vim-related files
+[._]*.s[a-w][a-z]
+[._]s[a-w][a-z]
+*.un~
+Session.vim
+.netrwhist
+
+# Go test binaries
+*.test
diff --git a/vendor/github.com/ghodss/yaml/.travis.yml b/vendor/github.com/ghodss/yaml/.travis.yml
new file mode 100644
index 0000000..0e9d6ed
--- /dev/null
+++ b/vendor/github.com/ghodss/yaml/.travis.yml
@@ -0,0 +1,7 @@
+language: go
+go:
+  - 1.3
+  - 1.4
+script:
+  - go test
+  - go build
diff --git a/vendor/github.com/ghodss/yaml/LICENSE b/vendor/github.com/ghodss/yaml/LICENSE
new file mode 100644
index 0000000..7805d36
--- /dev/null
+++ b/vendor/github.com/ghodss/yaml/LICENSE
@@ -0,0 +1,50 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Sam Ghods
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+
+Copyright (c) 2012 The Go Authors. All rights reserved.
+
+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.
diff --git a/vendor/github.com/ghodss/yaml/README.md b/vendor/github.com/ghodss/yaml/README.md
new file mode 100644
index 0000000..0200f75
--- /dev/null
+++ b/vendor/github.com/ghodss/yaml/README.md
@@ -0,0 +1,121 @@
+# YAML marshaling and unmarshaling support for Go
+
+[![Build Status](https://travis-ci.org/ghodss/yaml.svg)](https://travis-ci.org/ghodss/yaml)
+
+## Introduction
+
+A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs.
+
+In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/).
+
+## Compatibility
+
+This package uses [go-yaml](https://github.com/go-yaml/yaml) and therefore supports [everything go-yaml supports](https://github.com/go-yaml/yaml#compatibility).
+
+## Caveats
+
+**Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, go-yaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example:
+
+```
+BAD:
+	exampleKey: !!binary gIGC
+
+GOOD:
+	exampleKey: gIGC
+... and decode the base64 data in your code.
+```
+
+**Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys.
+
+## Installation and usage
+
+To install, run:
+
+```
+$ go get github.com/ghodss/yaml
+```
+
+And import using:
+
+```
+import "github.com/ghodss/yaml"
+```
+
+Usage is very similar to the JSON library:
+
+```go
+package main
+
+import (
+	"fmt"
+
+	"github.com/ghodss/yaml"
+)
+
+type Person struct {
+	Name string `json:"name"` // Affects YAML field names too.
+	Age  int    `json:"age"`
+}
+
+func main() {
+	// Marshal a Person struct to YAML.
+	p := Person{"John", 30}
+	y, err := yaml.Marshal(p)
+	if err != nil {
+		fmt.Printf("err: %v\n", err)
+		return
+	}
+	fmt.Println(string(y))
+	/* Output:
+	age: 30
+	name: John
+	*/
+
+	// Unmarshal the YAML back into a Person struct.
+	var p2 Person
+	err = yaml.Unmarshal(y, &p2)
+	if err != nil {
+		fmt.Printf("err: %v\n", err)
+		return
+	}
+	fmt.Println(p2)
+	/* Output:
+	{John 30}
+	*/
+}
+```
+
+`yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available:
+
+```go
+package main
+
+import (
+	"fmt"
+
+	"github.com/ghodss/yaml"
+)
+
+func main() {
+	j := []byte(`{"name": "John", "age": 30}`)
+	y, err := yaml.JSONToYAML(j)
+	if err != nil {
+		fmt.Printf("err: %v\n", err)
+		return
+	}
+	fmt.Println(string(y))
+	/* Output:
+	name: John
+	age: 30
+	*/
+	j2, err := yaml.YAMLToJSON(y)
+	if err != nil {
+		fmt.Printf("err: %v\n", err)
+		return
+	}
+	fmt.Println(string(j2))
+	/* Output:
+	{"age":30,"name":"John"}
+	*/
+}
+```
diff --git a/vendor/github.com/ghodss/yaml/fields.go b/vendor/github.com/ghodss/yaml/fields.go
new file mode 100644
index 0000000..5860074
--- /dev/null
+++ b/vendor/github.com/ghodss/yaml/fields.go
@@ -0,0 +1,501 @@
+// Copyright 2013 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.
+package yaml
+
+import (
+	"bytes"
+	"encoding"
+	"encoding/json"
+	"reflect"
+	"sort"
+	"strings"
+	"sync"
+	"unicode"
+	"unicode/utf8"
+)
+
+// indirect walks down v allocating pointers as needed,
+// until it gets to a non-pointer.
+// if it encounters an Unmarshaler, indirect stops and returns that.
+// if decodingNull is true, indirect stops at the last pointer so it can be set to nil.
+func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) {
+	// If v is a named type and is addressable,
+	// start with its address, so that if the type has pointer methods,
+	// we find them.
+	if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() {
+		v = v.Addr()
+	}
+	for {
+		// Load value from interface, but only if the result will be
+		// usefully addressable.
+		if v.Kind() == reflect.Interface && !v.IsNil() {
+			e := v.Elem()
+			if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) {
+				v = e
+				continue
+			}
+		}
+
+		if v.Kind() != reflect.Ptr {
+			break
+		}
+
+		if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() {
+			break
+		}
+		if v.IsNil() {
+			if v.CanSet() {
+				v.Set(reflect.New(v.Type().Elem()))
+			} else {
+				v = reflect.New(v.Type().Elem())
+			}
+		}
+		if v.Type().NumMethod() > 0 {
+			if u, ok := v.Interface().(json.Unmarshaler); ok {
+				return u, nil, reflect.Value{}
+			}
+			if u, ok := v.Interface().(encoding.TextUnmarshaler); ok {
+				return nil, u, reflect.Value{}
+			}
+		}
+		v = v.Elem()
+	}
+	return nil, nil, v
+}
+
+// A field represents a single field found in a struct.
+type field struct {
+	name      string
+	nameBytes []byte                 // []byte(name)
+	equalFold func(s, t []byte) bool // bytes.EqualFold or equivalent
+
+	tag       bool
+	index     []int
+	typ       reflect.Type
+	omitEmpty bool
+	quoted    bool
+}
+
+func fillField(f field) field {
+	f.nameBytes = []byte(f.name)
+	f.equalFold = foldFunc(f.nameBytes)
+	return f
+}
+
+// byName sorts field by name, breaking ties with depth,
+// then breaking ties with "name came from json tag", then
+// breaking ties with index sequence.
+type byName []field
+
+func (x byName) Len() int { return len(x) }
+
+func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
+
+func (x byName) Less(i, j int) bool {
+	if x[i].name != x[j].name {
+		return x[i].name < x[j].name
+	}
+	if len(x[i].index) != len(x[j].index) {
+		return len(x[i].index) < len(x[j].index)
+	}
+	if x[i].tag != x[j].tag {
+		return x[i].tag
+	}
+	return byIndex(x).Less(i, j)
+}
+
+// byIndex sorts field by index sequence.
+type byIndex []field
+
+func (x byIndex) Len() int { return len(x) }
+
+func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
+
+func (x byIndex) Less(i, j int) bool {
+	for k, xik := range x[i].index {
+		if k >= len(x[j].index) {
+			return false
+		}
+		if xik != x[j].index[k] {
+			return xik < x[j].index[k]
+		}
+	}
+	return len(x[i].index) < len(x[j].index)
+}
+
+// typeFields returns a list of fields that JSON should recognize for the given type.
+// The algorithm is breadth-first search over the set of structs to include - the top struct
+// and then any reachable anonymous structs.
+func typeFields(t reflect.Type) []field {
+	// Anonymous fields to explore at the current level and the next.
+	current := []field{}
+	next := []field{{typ: t}}
+
+	// Count of queued names for current level and the next.
+	count := map[reflect.Type]int{}
+	nextCount := map[reflect.Type]int{}
+
+	// Types already visited at an earlier level.
+	visited := map[reflect.Type]bool{}
+
+	// Fields found.
+	var fields []field
+
+	for len(next) > 0 {
+		current, next = next, current[:0]
+		count, nextCount = nextCount, map[reflect.Type]int{}
+
+		for _, f := range current {
+			if visited[f.typ] {
+				continue
+			}
+			visited[f.typ] = true
+
+			// Scan f.typ for fields to include.
+			for i := 0; i < f.typ.NumField(); i++ {
+				sf := f.typ.Field(i)
+				if sf.PkgPath != "" { // unexported
+					continue
+				}
+				tag := sf.Tag.Get("json")
+				if tag == "-" {
+					continue
+				}
+				name, opts := parseTag(tag)
+				if !isValidTag(name) {
+					name = ""
+				}
+				index := make([]int, len(f.index)+1)
+				copy(index, f.index)
+				index[len(f.index)] = i
+
+				ft := sf.Type
+				if ft.Name() == "" && ft.Kind() == reflect.Ptr {
+					// Follow pointer.
+					ft = ft.Elem()
+				}
+
+				// Record found field and index sequence.
+				if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct {
+					tagged := name != ""
+					if name == "" {
+						name = sf.Name
+					}
+					fields = append(fields, fillField(field{
+						name:      name,
+						tag:       tagged,
+						index:     index,
+						typ:       ft,
+						omitEmpty: opts.Contains("omitempty"),
+						quoted:    opts.Contains("string"),
+					}))
+					if count[f.typ] > 1 {
+						// If there were multiple instances, add a second,
+						// so that the annihilation code will see a duplicate.
+						// It only cares about the distinction between 1 or 2,
+						// so don't bother generating any more copies.
+						fields = append(fields, fields[len(fields)-1])
+					}
+					continue
+				}
+
+				// Record new anonymous struct to explore in next round.
+				nextCount[ft]++
+				if nextCount[ft] == 1 {
+					next = append(next, fillField(field{name: ft.Name(), index: index, typ: ft}))
+				}
+			}
+		}
+	}
+
+	sort.Sort(byName(fields))
+
+	// Delete all fields that are hidden by the Go rules for embedded fields,
+	// except that fields with JSON tags are promoted.
+
+	// The fields are sorted in primary order of name, secondary order
+	// of field index length. Loop over names; for each name, delete
+	// hidden fields by choosing the one dominant field that survives.
+	out := fields[:0]
+	for advance, i := 0, 0; i < len(fields); i += advance {
+		// One iteration per name.
+		// Find the sequence of fields with the name of this first field.
+		fi := fields[i]
+		name := fi.name
+		for advance = 1; i+advance < len(fields); advance++ {
+			fj := fields[i+advance]
+			if fj.name != name {
+				break
+			}
+		}
+		if advance == 1 { // Only one field with this name
+			out = append(out, fi)
+			continue
+		}
+		dominant, ok := dominantField(fields[i : i+advance])
+		if ok {
+			out = append(out, dominant)
+		}
+	}
+
+	fields = out
+	sort.Sort(byIndex(fields))
+
+	return fields
+}
+
+// dominantField looks through the fields, all of which are known to
+// have the same name, to find the single field that dominates the
+// others using Go's embedding rules, modified by the presence of
+// JSON tags. If there are multiple top-level fields, the boolean
+// will be false: This condition is an error in Go and we skip all
+// the fields.
+func dominantField(fields []field) (field, bool) {
+	// The fields are sorted in increasing index-length order. The winner
+	// must therefore be one with the shortest index length. Drop all
+	// longer entries, which is easy: just truncate the slice.
+	length := len(fields[0].index)
+	tagged := -1 // Index of first tagged field.
+	for i, f := range fields {
+		if len(f.index) > length {
+			fields = fields[:i]
+			break
+		}
+		if f.tag {
+			if tagged >= 0 {
+				// Multiple tagged fields at the same level: conflict.
+				// Return no field.
+				return field{}, false
+			}
+			tagged = i
+		}
+	}
+	if tagged >= 0 {
+		return fields[tagged], true
+	}
+	// All remaining fields have the same length. If there's more than one,
+	// we have a conflict (two fields named "X" at the same level) and we
+	// return no field.
+	if len(fields) > 1 {
+		return field{}, false
+	}
+	return fields[0], true
+}
+
+var fieldCache struct {
+	sync.RWMutex
+	m map[reflect.Type][]field
+}
+
+// cachedTypeFields is like typeFields but uses a cache to avoid repeated work.
+func cachedTypeFields(t reflect.Type) []field {
+	fieldCache.RLock()
+	f := fieldCache.m[t]
+	fieldCache.RUnlock()
+	if f != nil {
+		return f
+	}
+
+	// Compute fields without lock.
+	// Might duplicate effort but won't hold other computations back.
+	f = typeFields(t)
+	if f == nil {
+		f = []field{}
+	}
+
+	fieldCache.Lock()
+	if fieldCache.m == nil {
+		fieldCache.m = map[reflect.Type][]field{}
+	}
+	fieldCache.m[t] = f
+	fieldCache.Unlock()
+	return f
+}
+
+func isValidTag(s string) bool {
+	if s == "" {
+		return false
+	}
+	for _, c := range s {
+		switch {
+		case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c):
+			// Backslash and quote chars are reserved, but
+			// otherwise any punctuation chars are allowed
+			// in a tag name.
+		default:
+			if !unicode.IsLetter(c) && !unicode.IsDigit(c) {
+				return false
+			}
+		}
+	}
+	return true
+}
+
+const (
+	caseMask     = ^byte(0x20) // Mask to ignore case in ASCII.
+	kelvin       = '\u212a'
+	smallLongEss = '\u017f'
+)
+
+// foldFunc returns one of four different case folding equivalence
+// functions, from most general (and slow) to fastest:
+//
+// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8
+// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S')
+// 3) asciiEqualFold, no special, but includes non-letters (including _)
+// 4) simpleLetterEqualFold, no specials, no non-letters.
+//
+// The letters S and K are special because they map to 3 runes, not just 2:
+//  * S maps to s and to U+017F 'ſ' Latin small letter long s
+//  * k maps to K and to U+212A 'K' Kelvin sign
+// See http://play.golang.org/p/tTxjOc0OGo
+//
+// The returned function is specialized for matching against s and
+// should only be given s. It's not curried for performance reasons.
+func foldFunc(s []byte) func(s, t []byte) bool {
+	nonLetter := false
+	special := false // special letter
+	for _, b := range s {
+		if b >= utf8.RuneSelf {
+			return bytes.EqualFold
+		}
+		upper := b & caseMask
+		if upper < 'A' || upper > 'Z' {
+			nonLetter = true
+		} else if upper == 'K' || upper == 'S' {
+			// See above for why these letters are special.
+			special = true
+		}
+	}
+	if special {
+		return equalFoldRight
+	}
+	if nonLetter {
+		return asciiEqualFold
+	}
+	return simpleLetterEqualFold
+}
+
+// equalFoldRight is a specialization of bytes.EqualFold when s is
+// known to be all ASCII (including punctuation), but contains an 's',
+// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t.
+// See comments on foldFunc.
+func equalFoldRight(s, t []byte) bool {
+	for _, sb := range s {
+		if len(t) == 0 {
+			return false
+		}
+		tb := t[0]
+		if tb < utf8.RuneSelf {
+			if sb != tb {
+				sbUpper := sb & caseMask
+				if 'A' <= sbUpper && sbUpper <= 'Z' {
+					if sbUpper != tb&caseMask {
+						return false
+					}
+				} else {
+					return false
+				}
+			}
+			t = t[1:]
+			continue
+		}
+		// sb is ASCII and t is not. t must be either kelvin
+		// sign or long s; sb must be s, S, k, or K.
+		tr, size := utf8.DecodeRune(t)
+		switch sb {
+		case 's', 'S':
+			if tr != smallLongEss {
+				return false
+			}
+		case 'k', 'K':
+			if tr != kelvin {
+				return false
+			}
+		default:
+			return false
+		}
+		t = t[size:]
+
+	}
+	if len(t) > 0 {
+		return false
+	}
+	return true
+}
+
+// asciiEqualFold is a specialization of bytes.EqualFold for use when
+// s is all ASCII (but may contain non-letters) and contains no
+// special-folding letters.
+// See comments on foldFunc.
+func asciiEqualFold(s, t []byte) bool {
+	if len(s) != len(t) {
+		return false
+	}
+	for i, sb := range s {
+		tb := t[i]
+		if sb == tb {
+			continue
+		}
+		if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') {
+			if sb&caseMask != tb&caseMask {
+				return false
+			}
+		} else {
+			return false
+		}
+	}
+	return true
+}
+
+// simpleLetterEqualFold is a specialization of bytes.EqualFold for
+// use when s is all ASCII letters (no underscores, etc) and also
+// doesn't contain 'k', 'K', 's', or 'S'.
+// See comments on foldFunc.
+func simpleLetterEqualFold(s, t []byte) bool {
+	if len(s) != len(t) {
+		return false
+	}
+	for i, b := range s {
+		if b&caseMask != t[i]&caseMask {
+			return false
+		}
+	}
+	return true
+}
+
+// tagOptions is the string following a comma in a struct field's "json"
+// tag, or the empty string. It does not include the leading comma.
+type tagOptions string
+
+// parseTag splits a struct field's json tag into its name and
+// comma-separated options.
+func parseTag(tag string) (string, tagOptions) {
+	if idx := strings.Index(tag, ","); idx != -1 {
+		return tag[:idx], tagOptions(tag[idx+1:])
+	}
+	return tag, tagOptions("")
+}
+
+// Contains reports whether a comma-separated list of options
+// contains a particular substr flag. substr must be surrounded by a
+// string boundary or commas.
+func (o tagOptions) Contains(optionName string) bool {
+	if len(o) == 0 {
+		return false
+	}
+	s := string(o)
+	for s != "" {
+		var next string
+		i := strings.Index(s, ",")
+		if i >= 0 {
+			s, next = s[:i], s[i+1:]
+		}
+		if s == optionName {
+			return true
+		}
+		s = next
+	}
+	return false
+}
diff --git a/vendor/github.com/ghodss/yaml/yaml.go b/vendor/github.com/ghodss/yaml/yaml.go
new file mode 100644
index 0000000..4fb4054
--- /dev/null
+++ b/vendor/github.com/ghodss/yaml/yaml.go
@@ -0,0 +1,277 @@
+package yaml
+
+import (
+	"bytes"
+	"encoding/json"
+	"fmt"
+	"reflect"
+	"strconv"
+
+	"gopkg.in/yaml.v2"
+)
+
+// Marshals the object into JSON then converts JSON to YAML and returns the
+// YAML.
+func Marshal(o interface{}) ([]byte, error) {
+	j, err := json.Marshal(o)
+	if err != nil {
+		return nil, fmt.Errorf("error marshaling into JSON: %v", err)
+	}
+
+	y, err := JSONToYAML(j)
+	if err != nil {
+		return nil, fmt.Errorf("error converting JSON to YAML: %v", err)
+	}
+
+	return y, nil
+}
+
+// Converts YAML to JSON then uses JSON to unmarshal into an object.
+func Unmarshal(y []byte, o interface{}) error {
+	vo := reflect.ValueOf(o)
+	j, err := yamlToJSON(y, &vo)
+	if err != nil {
+		return fmt.Errorf("error converting YAML to JSON: %v", err)
+	}
+
+	err = json.Unmarshal(j, o)
+	if err != nil {
+		return fmt.Errorf("error unmarshaling JSON: %v", err)
+	}
+
+	return nil
+}
+
+// Convert JSON to YAML.
+func JSONToYAML(j []byte) ([]byte, error) {
+	// Convert the JSON to an object.
+	var jsonObj interface{}
+	// We are using yaml.Unmarshal here (instead of json.Unmarshal) because the
+	// Go JSON library doesn't try to pick the right number type (int, float,
+	// etc.) when unmarshalling to interface{}, it just picks float64
+	// universally. go-yaml does go through the effort of picking the right
+	// number type, so we can preserve number type throughout this process.
+	err := yaml.Unmarshal(j, &jsonObj)
+	if err != nil {
+		return nil, err
+	}
+
+	// Marshal this object into YAML.
+	return yaml.Marshal(jsonObj)
+}
+
+// Convert YAML to JSON. Since JSON is a subset of YAML, passing JSON through
+// this method should be a no-op.
+//
+// Things YAML can do that are not supported by JSON:
+// * In YAML you can have binary and null keys in your maps. These are invalid
+//   in JSON. (int and float keys are converted to strings.)
+// * Binary data in YAML with the !!binary tag is not supported. If you want to
+//   use binary data with this library, encode the data as base64 as usual but do
+//   not use the !!binary tag in your YAML. This will ensure the original base64
+//   encoded data makes it all the way through to the JSON.
+func YAMLToJSON(y []byte) ([]byte, error) {
+	return yamlToJSON(y, nil)
+}
+
+func yamlToJSON(y []byte, jsonTarget *reflect.Value) ([]byte, error) {
+	// Convert the YAML to an object.
+	var yamlObj interface{}
+	err := yaml.Unmarshal(y, &yamlObj)
+	if err != nil {
+		return nil, err
+	}
+
+	// YAML objects are not completely compatible with JSON objects (e.g. you
+	// can have non-string keys in YAML). So, convert the YAML-compatible object
+	// to a JSON-compatible object, failing with an error if irrecoverable
+	// incompatibilties happen along the way.
+	jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget)
+	if err != nil {
+		return nil, err
+	}
+
+	// Convert this object to JSON and return the data.
+	return json.Marshal(jsonObj)
+}
+
+func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) {
+	var err error
+
+	// Resolve jsonTarget to a concrete value (i.e. not a pointer or an
+	// interface). We pass decodingNull as false because we're not actually
+	// decoding into the value, we're just checking if the ultimate target is a
+	// string.
+	if jsonTarget != nil {
+		ju, tu, pv := indirect(*jsonTarget, false)
+		// We have a JSON or Text Umarshaler at this level, so we can't be trying
+		// to decode into a string.
+		if ju != nil || tu != nil {
+			jsonTarget = nil
+		} else {
+			jsonTarget = &pv
+		}
+	}
+
+	// If yamlObj is a number or a boolean, check if jsonTarget is a string -
+	// if so, coerce.  Else return normal.
+	// If yamlObj is a map or array, find the field that each key is
+	// unmarshaling to, and when you recurse pass the reflect.Value for that
+	// field back into this function.
+	switch typedYAMLObj := yamlObj.(type) {
+	case map[interface{}]interface{}:
+		// JSON does not support arbitrary keys in a map, so we must convert
+		// these keys to strings.
+		//
+		// From my reading of go-yaml v2 (specifically the resolve function),
+		// keys can only have the types string, int, int64, float64, binary
+		// (unsupported), or null (unsupported).
+		strMap := make(map[string]interface{})
+		for k, v := range typedYAMLObj {
+			// Resolve the key to a string first.
+			var keyString string
+			switch typedKey := k.(type) {
+			case string:
+				keyString = typedKey
+			case int:
+				keyString = strconv.Itoa(typedKey)
+			case int64:
+				// go-yaml will only return an int64 as a key if the system
+				// architecture is 32-bit and the key's value is between 32-bit
+				// and 64-bit. Otherwise the key type will simply be int.
+				keyString = strconv.FormatInt(typedKey, 10)
+			case float64:
+				// Stolen from go-yaml to use the same conversion to string as
+				// the go-yaml library uses to convert float to string when
+				// Marshaling.
+				s := strconv.FormatFloat(typedKey, 'g', -1, 32)
+				switch s {
+				case "+Inf":
+					s = ".inf"
+				case "-Inf":
+					s = "-.inf"
+				case "NaN":
+					s = ".nan"
+				}
+				keyString = s
+			case bool:
+				if typedKey {
+					keyString = "true"
+				} else {
+					keyString = "false"
+				}
+			default:
+				return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v",
+					reflect.TypeOf(k), k, v)
+			}
+
+			// jsonTarget should be a struct or a map. If it's a struct, find
+			// the field it's going to map to and pass its reflect.Value. If
+			// it's a map, find the element type of the map and pass the
+			// reflect.Value created from that type. If it's neither, just pass
+			// nil - JSON conversion will error for us if it's a real issue.
+			if jsonTarget != nil {
+				t := *jsonTarget
+				if t.Kind() == reflect.Struct {
+					keyBytes := []byte(keyString)
+					// Find the field that the JSON library would use.
+					var f *field
+					fields := cachedTypeFields(t.Type())
+					for i := range fields {
+						ff := &fields[i]
+						if bytes.Equal(ff.nameBytes, keyBytes) {
+							f = ff
+							break
+						}
+						// Do case-insensitive comparison.
+						if f == nil && ff.equalFold(ff.nameBytes, keyBytes) {
+							f = ff
+						}
+					}
+					if f != nil {
+						// Find the reflect.Value of the most preferential
+						// struct field.
+						jtf := t.Field(f.index[0])
+						strMap[keyString], err = convertToJSONableObject(v, &jtf)
+						if err != nil {
+							return nil, err
+						}
+						continue
+					}
+				} else if t.Kind() == reflect.Map {
+					// Create a zero value of the map's element type to use as
+					// the JSON target.
+					jtv := reflect.Zero(t.Type().Elem())
+					strMap[keyString], err = convertToJSONableObject(v, &jtv)
+					if err != nil {
+						return nil, err
+					}
+					continue
+				}
+			}
+			strMap[keyString], err = convertToJSONableObject(v, nil)
+			if err != nil {
+				return nil, err
+			}
+		}
+		return strMap, nil
+	case []interface{}:
+		// We need to recurse into arrays in case there are any
+		// map[interface{}]interface{}'s inside and to convert any
+		// numbers to strings.
+
+		// If jsonTarget is a slice (which it really should be), find the
+		// thing it's going to map to. If it's not a slice, just pass nil
+		// - JSON conversion will error for us if it's a real issue.
+		var jsonSliceElemValue *reflect.Value
+		if jsonTarget != nil {
+			t := *jsonTarget
+			if t.Kind() == reflect.Slice {
+				// By default slices point to nil, but we need a reflect.Value
+				// pointing to a value of the slice type, so we create one here.
+				ev := reflect.Indirect(reflect.New(t.Type().Elem()))
+				jsonSliceElemValue = &ev
+			}
+		}
+
+		// Make and use a new array.
+		arr := make([]interface{}, len(typedYAMLObj))
+		for i, v := range typedYAMLObj {
+			arr[i], err = convertToJSONableObject(v, jsonSliceElemValue)
+			if err != nil {
+				return nil, err
+			}
+		}
+		return arr, nil
+	default:
+		// If the target type is a string and the YAML type is a number,
+		// convert the YAML type to a string.
+		if jsonTarget != nil && (*jsonTarget).Kind() == reflect.String {
+			// Based on my reading of go-yaml, it may return int, int64,
+			// float64, or uint64.
+			var s string
+			switch typedVal := typedYAMLObj.(type) {
+			case int:
+				s = strconv.FormatInt(int64(typedVal), 10)
+			case int64:
+				s = strconv.FormatInt(typedVal, 10)
+			case float64:
+				s = strconv.FormatFloat(typedVal, 'g', -1, 32)
+			case uint64:
+				s = strconv.FormatUint(typedVal, 10)
+			case bool:
+				if typedVal {
+					s = "true"
+				} else {
+					s = "false"
+				}
+			}
+			if len(s) > 0 {
+				yamlObj = interface{}(s)
+			}
+		}
+		return yamlObj, nil
+	}
+
+	return nil, nil
+}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 408ba12..69bbb56 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -16,6 +16,10 @@
 github.com/eapache/go-xerial-snappy
 # github.com/eapache/queue v1.1.0
 github.com/eapache/queue
+# github.com/fatih/structs v1.1.0
+github.com/fatih/structs
+# github.com/ghodss/yaml v1.0.0
+github.com/ghodss/yaml
 # github.com/golang/protobuf v1.3.2
 github.com/golang/protobuf/descriptor
 github.com/golang/protobuf/jsonpb