Making DHCP hostnames unique
Using standard format for DHCP Client ID

Change-Id: Ia61f4b07aa23d7f7c911e9255c7769da394399f1
diff --git a/VERSION b/VERSION
index 524cb55..13c0078 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.1
+1.1.2-dev
diff --git a/configs/dhcpd.conf b/configs/dhcpd.conf
index 2ab1fe5..9a480fe 100644
--- a/configs/dhcpd.conf
+++ b/configs/dhcpd.conf
@@ -5,7 +5,7 @@
 ddns-update-style none;
 
 option domain-name "example.org";
-option domain-name-servers ns1.example.org, ns2.example.org;
+# option domain-name-servers ns1.example.org, ns2.example.org;
 
 default-lease-time 600;
 max-lease-time 7200;
diff --git a/internal/bbsim/responders/dhcp/dhcp.go b/internal/bbsim/responders/dhcp/dhcp.go
index 8ec3939..fe7e847 100644
--- a/internal/bbsim/responders/dhcp/dhcp.go
+++ b/internal/bbsim/responders/dhcp/dhcp.go
@@ -82,8 +82,8 @@
 	}
 }
 
-func createDefaultOpts(intfId uint32, onuId uint32) []layers.DHCPOption {
-	hostname := []byte(fmt.Sprintf("%d.%d.bbsim.onf.org", intfId, onuId))
+func createDefaultOpts(gemPortId uint32, intfId uint32, onuId uint32) []layers.DHCPOption {
+	hostname := []byte(fmt.Sprintf("%d.%d.%d.bbsim.onf.org", gemPortId, intfId, onuId))
 	opts := []layers.DHCPOption{}
 	opts = append(opts, layers.DHCPOption{
 		Type:   layers.DHCPOptHostname,
@@ -106,15 +106,15 @@
 
 func createDHCPDisc(intfId uint32, onuId uint32, gemPort uint32, macAddress net.HardwareAddr) *layers.DHCPv4 {
 	dhcpLayer := createDefaultDHCPReq(macAddress)
-	defaultOpts := createDefaultOpts(intfId, onuId)
+	defaultOpts := createDefaultOpts(gemPort, intfId, onuId)
 	dhcpLayer.Options = append([]layers.DHCPOption{{
 		Type:   layers.DHCPOptMessageType,
 		Data:   []byte{byte(layers.DHCPMsgTypeDiscover)},
 		Length: 1,
 	}}, defaultOpts...)
 
-	data := []byte{0xcd, 0x28, 0xcb, 0xcc, 0x00, 0x01, 0x00, 0x01,
-		0x23, 0xed, 0x11, 0xec, 0x4e, 0xfc, 0xcd, byte(intfId), byte(onuId), byte(gemPort)} //FIXME use the OLT-ID in here
+	data := []byte{01}
+	data = append(data, macAddress...)
 	dhcpLayer.Options = append(dhcpLayer.Options, layers.DHCPOption{
 		Type:   layers.DHCPOptClientID,
 		Data:   data,
@@ -124,9 +124,9 @@
 	return &dhcpLayer
 }
 
-func createDHCPReq(intfId uint32, onuId uint32, macAddress net.HardwareAddr, offeredIp net.IP) *layers.DHCPv4 {
+func createDHCPReq(intfId uint32, onuId uint32, macAddress net.HardwareAddr, offeredIp net.IP, gemPortId uint32) *layers.DHCPv4 {
 	dhcpLayer := createDefaultDHCPReq(macAddress)
-	defaultOpts := createDefaultOpts(intfId, onuId)
+	defaultOpts := createDefaultOpts(gemPortId, intfId, onuId)
 
 	dhcpLayer.Options = append(defaultOpts, layers.DHCPOption{
 		Type:   layers.DHCPOptMessageType,
@@ -276,7 +276,7 @@
 func sendDHCPRequest(ponPortId uint32, onuId uint32, serviceName string, serialNumber string, portNo uint32,
 	cTag int, gemPortId uint32, onuStateMachine *fsm.FSM, onuHwAddress net.HardwareAddr,
 	offeredIp net.IP, pbit uint8, stream bbsim.Stream) error {
-	dhcp := createDHCPReq(ponPortId, onuId, onuHwAddress, offeredIp)
+	dhcp := createDHCPReq(ponPortId, onuId, onuHwAddress, offeredIp, gemPortId)
 	pkt, err := serializeDHCPPacket(ponPortId, onuId, cTag, onuHwAddress, dhcp, pbit)
 
 	if err != nil {