[VOL-2451] Reporting UNI Link Up alarm via OMCI

Change-Id: I6fd30af5f558cd41bca617247d859bdcc2ff2ed9
diff --git a/vendor/github.com/opencord/omci-sim/omci_sim.go b/vendor/github.com/opencord/omci-sim/omci_sim.go
index a792911..c971d54 100644
--- a/vendor/github.com/opencord/omci-sim/omci_sim.go
+++ b/vendor/github.com/opencord/omci-sim/omci_sim.go
@@ -21,7 +21,7 @@
 	log "github.com/sirupsen/logrus"
 )
 
-var omciCh = make(chan OmciChMessage)
+var omciCh = make(chan OmciChMessage, 4096)
 
 func GetChannel() chan OmciChMessage {
 	return omciCh
@@ -48,7 +48,7 @@
 		"MeInstance": instance,
 		//"Conent": content,
 		"omciMsg": fmt.Sprintf("%x", content),
-	}).Tracef("Processing OMCI pakcet")
+	}).Tracef("Processing OMCI packet")
 
 	key := OnuKey{intfId, onuId}
 	OnuOmciStateMapLock.Lock()
@@ -105,6 +105,62 @@
 		}
 	}
 
+	if (class == 11 && instance == 257 && msgType == Set) {
+		// This is a set on a PPTP instance 257 (lan port 1)
+		// Determine if its setting admin up or down and alarm appropriately
+
+		// attrmask for what specifically sets/gets is 2 bytes
+		attrmask := content[0:2]
+		// actual content is the rest, as specified by attrmask.  but for this case we are only interested in 1 byte
+		firstattr := content[2:3]
+
+		// attribute bit 5 (admin state) in the PPTP is being set, its value is 1, lock
+		if (attrmask[0] == 0x08 && firstattr[0] == 0x01) {
+			log.Info("Send UNI Link Down Alarm on OMCI Sim channel")
+
+			linkMsgDown := []byte{
+				0x00, 0x00, 0x10, 0x0a, 0x00, 0x0b, 0x01, 0x01,
+				0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+
+			msg := OmciChMessage{
+				Type: UniLinkDown,
+				Data: OmciChMessageData{
+					OnuId:  key.OnuId,
+					IntfId: key.IntfId,
+				},
+				Packet: linkMsgDown,
+			}
+			omciCh <- msg
+		}
+
+		// attribute bit 5 (admin state) in the PPTP is being set, its value is 0, unlock
+		if (attrmask[0] == 0x08 && firstattr[0] == 0x00) {
+			log.Info("Send UNI Link Up Alarm on OMCI Sim channel")
+
+			linkMsgUp := []byte{
+				0x00, 0x00, 0x10, 0x0a, 0x00, 0x0b, 0x01, 0x01,
+				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+
+			msg := OmciChMessage{
+				Type: UniLinkUp,
+				Data: OmciChMessageData{
+					OnuId:  key.OnuId,
+					IntfId: key.IntfId,
+				},
+				Packet: linkMsgUp,
+			}
+			omciCh <- msg
+		}
+	}
+
 	log.WithFields(log.Fields{
 		"IntfId": intfId,
 		"OnuId": onuId,