EOAM updates

Change-Id: I17c98ca67bb0617026dd08823f389134410a2a74
diff --git a/voltha/adapters/tibit_olt/tibit_olt.py b/voltha/adapters/tibit_olt/tibit_olt.py
index b836e2f..e2ee432 100644
--- a/voltha/adapters/tibit_olt/tibit_olt.py
+++ b/voltha/adapters/tibit_olt/tibit_olt.py
@@ -424,7 +424,7 @@
                         log.info('#### field.type == ETH_TYPE ####')
                         _type = field.eth_type
                         dn_req /= PortIngressRuleClauseMatchLength02(
-                            fieldcode=3,
+                            fieldcode=ClauseFields['L2 Type/Len'],
                             operator=1,
                             match0=(_type >> 8) & 0xff,
                             match1=_type & 0xff)
@@ -509,7 +509,7 @@
                     if field.type == ETH_TYPE:
                         _type = field.eth_type
                         up_req /= PortIngressRuleClauseMatchLength02(
-                            fieldcode=3,
+                            fieldcode=ClauseFields['L2 Type/Len'],
                             operator=1,
                             match0=(_type >> 8) & 0xff,
                             match1=_type & 0xff)
diff --git a/voltha/extensions/eoam/EOAM.py b/voltha/extensions/eoam/EOAM.py
index b7b6425..a671c4d 100644
--- a/voltha/extensions/eoam/EOAM.py
+++ b/voltha/extensions/eoam/EOAM.py
@@ -159,12 +159,16 @@
                         help='Send the critical OAM set of set_request()')
     parser.add_argument('-ta', '--test_add', dest='test_add', action='store_true', default=False,
                         help='Run commands under test')
-    parser.add_argument('-td', '--test_del', dest='test_del', action='store_true', default=False,
-                        help='Run commands under test')
     parser.add_argument('-tc', '--test_clr', dest='test_clr', action='store_true', default=False,
                         help='Run commands under test')
     parser.add_argument('-te', '--test_eapol', dest='test_eapol', action='store_true', default=False,
                         help='Run commands under test')
+    parser.add_argument('-tu', '--test_upstream', dest='test_upstream', action='store_true', default=False,
+                        help='Run commands under test')
+    parser.add_argument('-td', '--test_downstream', dest='test_downstream', action='store_true', default=False,
+                        help='Run commands under test')
+    parser.add_argument('-tm', '--test_multicast', dest='test_multicast', action='store_true', default=False,
+                        help='Run commands under test')
 
     args = parser.parse_args()
 
@@ -186,9 +190,11 @@
     if (not args.critical
         and not args.test
         and not args.test_add
-        and not args.test_del
         and not args.test_clr
-        and not args.test_eapol):
+        and not args.test_eapol
+        and not args.test_upstream
+        and not args.test_downstream
+        and not args.test_multicast):
         print 'WARNING: *** No frames sent, please specify \'test\' or \'critical\', etc.  See --help'
 
 
@@ -200,29 +206,23 @@
         eoam.send_multicast_register(MulticastRegisterSet(ActionFlags="Deregister",MulticastLink=0x3fe0, UnicastLink=0x1008))
 
     if (args.test_clr == True):
-#        print 'Set - Clear Static MAC Table -- User Port Object'
-#        eoam.set_request(ClearStaticMacTable())
+        print 'Set - Clear Static MAC Table -- User Port Object'
+        eoam.set_request(ClearStaticMacTable())
 
-        print 'Delete - Port Ingress Rule'
-        eoam.set_request(DOLTObject()/
-                         PortIngressRuleHeader(precedence=32)/
-                         PortIngressRuleClauseMatchLength02(fieldcode=3, operator=1, match0=0x88, match1=0x8e)/
-                         PortIngressRuleResultForward()/
-                         PortIngressRuleResultSet(fieldcode=7, value=4090)/
-                         PortIngressRuleResultInsert(fieldcode=7)/
-                         PortIngressRuleTerminator()/
-                         DeletePortIngressRule())
-
-    elif (args.test_add == True):
+    if (args.test_add == True):
         print 'SET Add Static MAC Address -- User Port Object'
         eoam.set_request(AddStaticMacAddress(mac=IGMP_MULTICAST_ADDRESS))
 
-    elif (args.test_del == True):
+        time.sleep(15)
+
         print 'SET Delete Static MAC Address -- User Port Object'
         eoam.set_request(DeleteStaticMacAddress(mac=IGMP_MULTICAST_ADDRESS))
 
     if (args.test_eapol == True):
-        print 'SET - Port Ingress Rule -- User Port Object -- Precedence 32 Match 0x888e'
+        #################################################################################
+        ## EAPOL
+        #################################################################################
+        print 'SET - Port Ingress Rule -- DOLT Port Object -- EAPOL'
         eoam.set_request(DOLTObject()/
                          PortIngressRuleHeader(precedence=32)/
                          PortIngressRuleClauseMatchLength02(fieldcode=3, operator=1, match0=0x88, match1=0x8e)/
@@ -232,3 +232,116 @@
                          PortIngressRuleTerminator()/
                          AddPortIngressRule())
 
+        print 'Delete - Port Ingress Rule -- DOLT Port Object -- EAPOL'
+        eoam.set_request(DOLTObject()/
+                         PortIngressRuleHeader(precedence=32)/
+                         PortIngressRuleClauseMatchLength02(fieldcode=3, operator=1, match0=0x88, match1=0x8e)/
+                         PortIngressRuleResultForward()/
+                         PortIngressRuleResultSet(fieldcode=7, value=4090)/
+                         PortIngressRuleResultInsert(fieldcode=7)/
+                         PortIngressRuleTerminator()/
+                         DeletePortIngressRule())
+
+    if (args.test_upstream == True):
+        #################################################################################
+        ## UPSTREAM
+        #################################################################################
+        ClauseFields = {v: k for k, v in ClauseSubtypeEnum.iteritems()}
+        OperatorFields = {v: k for k, v in RuleOperatorEnum.iteritems()}
+
+        print 'SET - Port Ingress Rule -- OLT Unicast Logical Link -- Upstream Traffic'
+        eoam.set_request(OLTUnicastLogicalLink(unicastvssn="TBIT", unicastlink=0xe2222900)/
+                         PortIngressRuleHeader(precedence=13)/
+                         PortIngressRuleClauseMatchLength02(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=0,
+                                                            operator=OperatorFields['=='], match0=0x00, match1=0xf1)/
+                         PortIngressRuleResultForward()/
+                         PortIngressRuleResultCopy(fieldcode=ClauseFields['C-VLAN Tag'])/
+                         PortIngressRuleResultInsert(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=1)/
+                         PortIngressRuleResultSet(fieldcode=ClauseFields['C-VLAN Tag'], value=1000)/
+                         PortIngressRuleResultReplace(fieldcode=ClauseFields['C-VLAN Tag'])/
+                         PortIngressRuleTerminator()/
+                         AddPortIngressRule())
+
+
+        time.sleep(15)
+
+        print 'DELETE - Port Ingress Rule -- OLT Unicast Logical Link -- Upstream Traffic'
+        eoam.set_request(OLTUnicastLogicalLink(unicastvssn="TBIT", unicastlink=0xe2222900)/
+                         PortIngressRuleHeader(precedence=13)/
+                         PortIngressRuleClauseMatchLength02(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=0,
+                                                            operator=OperatorFields['=='], match0=0x00, match1=0xf1)/
+                         PortIngressRuleResultForward()/
+                         PortIngressRuleResultCopy(fieldcode=ClauseFields['C-VLAN Tag'])/
+                         PortIngressRuleResultInsert(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=1)/
+                         PortIngressRuleResultSet(fieldcode=ClauseFields['C-VLAN Tag'], value=1000)/
+                         PortIngressRuleResultReplace(fieldcode=ClauseFields['C-VLAN Tag'])/
+                         PortIngressRuleTerminator()/
+                         DeletePortIngressRule())
+
+    if (args.test_downstream == True):
+        #################################################################################
+        ## DOWNSTREAM
+        #################################################################################
+        ClauseFields = {v: k for k, v in ClauseSubtypeEnum.iteritems()}
+        OperatorFields = {v: k for k, v in RuleOperatorEnum.iteritems()}
+
+        print 'SET - Port Ingress Rule -- NNI Port Object -- Downstream Traffic'
+        eoam.set_request(NetworkToNetworkPortObject()/
+                         PortIngressRuleHeader(precedence=13)/
+                         PortIngressRuleClauseMatchLength02(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=0,
+                                                            operator=OperatorFields['=='], match0=0x0f, match1=0xa0)/
+                         PortIngressRuleClauseMatchLength02(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=1,
+                                                            operator=OperatorFields['=='], match0=0x00, match1=0xf1)/
+                         PortIngressRuleResultOLTQueue(unicastvssn="TBIT", unicastlink=0xe2222900)/
+                         PortIngressRuleResultForward()/
+                         PortIngressRuleResultDelete(fieldcode=ClauseFields['C-VLAN Tag'])/
+                         PortIngressRuleTerminator()/
+                         AddPortIngressRule())
+
+
+        time.sleep(15)
+
+        print 'DELETE - Port Ingress Rule -- NNI Port Object -- Downstream Traffic'
+        eoam.set_request(NetworkToNetworkPortObject()/
+                         PortIngressRuleHeader(precedence=13)/
+                         PortIngressRuleClauseMatchLength02(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=0,
+                                                            operator=OperatorFields['=='], match0=0x0f, match1=0xa0)/
+                         PortIngressRuleClauseMatchLength02(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=1,
+                                                            operator=OperatorFields['=='], match0=0x00, match1=0xf1)/
+                         PortIngressRuleResultOLTQueue(unicastvssn="TBIT", unicastlink=0xe2222900)/
+                         PortIngressRuleResultForward()/
+                         PortIngressRuleResultDelete(fieldcode=ClauseFields['C-VLAN Tag'])/
+                         PortIngressRuleTerminator()/
+                         DeletePortIngressRule())
+
+    if (args.test_multicast == True):
+        #################################################################################
+        ## MULTICAST
+        #################################################################################
+        ClauseFields = {v: k for k, v in ClauseSubtypeEnum.iteritems()}
+        OperatorFields = {v: k for k, v in RuleOperatorEnum.iteritems()}
+
+        print 'SET - Port Ingress Rule -- NNI Port Object -- Downstream Multicast Traffic'
+        eoam.set_request(NetworkToNetworkPortObject()/
+                         PortIngressRuleHeader(precedence=13)/
+                         PortIngressRuleClauseMatchLength02(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=0,
+                                                            operator=OperatorFields['=='], match0=0x00, match1=0x8c)/
+                         PortIngressRuleResultOLTBroadcastQueue()/
+                         PortIngressRuleResultForward()/
+                         PortIngressRuleResultDelete(fieldcode=ClauseFields['C-VLAN Tag'])/
+                         PortIngressRuleTerminator()/
+                         AddPortIngressRule())
+
+
+        time.sleep(15)
+
+        print 'DELETE - Port Ingress Rule -- NNI Port Object -- Downstream Multicast Traffic'
+        eoam.set_request(NetworkToNetworkPortObject()/
+                         PortIngressRuleHeader(precedence=13)/
+                         PortIngressRuleClauseMatchLength02(fieldcode=ClauseFields['C-VLAN Tag'], fieldinstance=0,
+                                                            operator=OperatorFields['=='], match0=0x00, match1=0x8c)/
+                         PortIngressRuleResultOLTBroadcastQueue()/
+                         PortIngressRuleResultForward()/
+                         PortIngressRuleResultDelete(fieldcode=ClauseFields['C-VLAN Tag'])/
+                         PortIngressRuleTerminator()/
+                         DeletePortIngressRule())
diff --git a/voltha/extensions/eoam/EOAM_TLV.py b/voltha/extensions/eoam/EOAM_TLV.py
index 9598967..0558aa4 100644
--- a/voltha/extensions/eoam/EOAM_TLV.py
+++ b/voltha/extensions/eoam/EOAM_TLV.py
@@ -13,6 +13,7 @@
 from scapy.packet import Packet
 from scapy.fields import ByteEnumField, XShortField, XByteField, MACField, \
     ByteField, BitEnumField, BitField
+from scapy.fields import XLongField, StrField, XIntField
 
 # This library strives to be an implementation of the following standard:
 
@@ -21,6 +22,13 @@
 # This library may be used with PON devices for
 # configuration and provisioning.
 
+## Note on Deviations:
+
+## Tibit endeavors to use DPoE OAM for not only communicating with DpOE ONUs,
+## but also to communicate with the Tibit OLT Microplug.  In places where this
+## document deviates from the DPoE standard for ONUs, Tibit has added a comment
+## __TIBIT_OLT_OAM__
+
 TIBIT_VERSION_NUMBER = '1.1.4'
 
 TLV_dictionary = {
@@ -141,16 +149,17 @@
     fields_desc = [XByteField("branch", 0xD6),
                    XShortField("leaf", 0x0000),
                    XByteField("length", 1),
-                   XByteField("num", 0)
+                   XByteField("number", 0)
                    ]
 
+# __TIBIT_OLT_OAM__: Defined by Tibit
 class DOLTObject(Packet):
     """ Object Context: D-OLT Object """
     name = "Object Context: D-OLT Object"
     fields_desc = [XByteField("branch", 0xD6),
                    XShortField("leaf", 0x0000),
                    XByteField("length", 1),
-                   XByteField("num", 0)
+                   XByteField("number", 0)
                    ]
 
 class NetworkPortObject(Packet):
@@ -159,16 +168,17 @@
     fields_desc = [XByteField("branch", 0xD6),
                    XShortField("leaf", 0x0001),
                    XByteField("length", 1),
-                   XByteField("num", 0)
+                   XByteField("number", 0)
                    ]
 
+# __TIBIT_OLT_OAM__: Defined by Tibit
 class PonPortObject(Packet):
     """ Object Context: PON Port Object """
     name = "Object Context: PON Port Object"
     fields_desc = [XByteField("branch", 0xD6),
                    XShortField("leaf", 0x0001),
                    XByteField("length", 1),
-                   XByteField("num", 1)
+                   XByteField("number", 0)
                    ]
 
 class UnicastLogicalLink(Packet):
@@ -180,6 +190,29 @@
                    XByteField("number", 0)
                    ]
 
+# __TIBIT_OLT_OAM__: Defined by Tibit
+class OLTUnicastLogicalLink(Packet):
+    """ Object Context: OLT Unicast Logical Link """
+    name = "Object Context: OLT Unicast Logical Link"
+    fields_desc = [XByteField("branch", 0xD6),
+                   XShortField("leaf", 0x000a),
+                   XByteField("length", 10),
+                   XByteField("pon", 0),
+                   StrField("unicastvssn", "TBIT"),
+                   XIntField("unicastlink", 0x00000000),
+                   XByteField("pad", 0),
+                   ]
+
+# __TIBIT_OLT_OAM__: Defined by Tibit
+class NetworkToNetworkPortObject(Packet):
+    """ Object Context: Network-to-Network (NNI) Port Object """
+    name = "Object Context: Network-to-Network (NNI) Port Object"
+    fields_desc = [XByteField("branch", 0xD6),
+                   XShortField("leaf", 0x0003),
+                   XByteField("length", 1),
+                   XByteField("number", 0)
+                   ]
+
 class UserPortObject(Packet):
     """ Object Context: User Port Object """
     name = "Object Context: User Port Object"
@@ -763,6 +796,16 @@
                      0x1f: "Custom field 7",
                      }
 
+RuleOperatorEnum = { 0x00: "F",             #False
+                     0x01: "==",
+                     0x02: "!=",
+                     0x03: "<=",
+                     0x04: ">=",
+                     0x05: "exists",
+                     0x06: "!exist",
+                     0x07: "T",
+                     }
+
 class PortIngressRule(Packet):
     """ Variable Descriptor: Port Ingress Rule """
     name = "Variable Descriptor: Port Ingress Rule"
@@ -773,162 +816,222 @@
 class PortIngressRuleHeader(Packet):
     """ Variable Descriptor: Port Ingress Rule Header """
     name = "Variable Descriptor: Port Ingress Rule Header"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 2),
-        XByteField("header", 1),
-        XByteField("precedence", 00),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 2),
+                   XByteField("header", 1),
+                   XByteField("precedence", 00),
+                   ]
 
 class PortIngressRuleClauseMatchLength00(Packet):
     """ Variable Descriptor: Port Ingress Rule Clause """
     name = "Variable Descriptor: Port Ingress Rule Clause"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 7),
-        XByteField("clause", 2),
-        XByteField("fieldcode", 0),
-        XByteField("fieldinstance", 0),
-        XByteField("msbmask", 0),
-        XByteField("lsbmask", 0),
-        XByteField("operator", 0),
-        XByteField("matchlength", 0),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 7),
+                   XByteField("clause", 2),
+                   XByteField("fieldcode", 0),
+                   XByteField("fieldinstance", 0),
+                   XByteField("msbmask", 0),
+                   XByteField("lsbmask", 0),
+                   XByteField("operator", 0),
+                   XByteField("matchlength", 0),
+                   ]
 
 class PortIngressRuleClauseMatchLength01(Packet):
     """ Variable Descriptor: Port Ingress Rule Clause """
     name = "Variable Descriptor: Port Ingress Rule Clause"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 8),
-        XByteField("clause", 2),
-        XByteField("fieldcode", 0),
-        XByteField("fieldinstance", 0),
-        XByteField("msbmask", 0),
-        XByteField("lsbmask", 0),
-        XByteField("operator", 0),
-        XByteField("matchlength", 1),
-        XByteField("match0", 0),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 8),
+                   XByteField("clause", 2),
+                   XByteField("fieldcode", 0),
+                   XByteField("fieldinstance", 0),
+                   XByteField("msbmask", 0),
+                   XByteField("lsbmask", 0),
+                   XByteField("operator", 0),
+                   XByteField("matchlength", 1),
+                   XByteField("match0", 0),
+                   ]
 
 class PortIngressRuleClauseMatchLength02(Packet):
     """ Variable Descriptor: Port Ingress Rule Clause """
     name = "Variable Descriptor: Port Ingress Rule Clause"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 9),
-        XByteField("clause", 2),
-        XByteField("fieldcode", 0),
-        XByteField("fieldinstance", 0),
-        XByteField("msbmask", 0),
-        XByteField("lsbmask", 0),
-        XByteField("operator", 0),
-        XByteField("matchlength", 2),
-        XByteField("match0", 0),
-        XByteField("match1", 0),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 9),
+                   XByteField("clause", 2),
+                   XByteField("fieldcode", 0),
+                   XByteField("fieldinstance", 0),
+                   XByteField("msbmask", 0),
+                   XByteField("lsbmask", 0),
+                   XByteField("operator", 0),
+                   XByteField("matchlength", 2),
+                   XByteField("match0", 0),
+                   XByteField("match1", 0),
+                   ]
 
 
 class PortIngressRuleClauseMatchLength06(Packet):
     """ Variable Descriptor: Port Ingress Rule Clause """
     name = "Variable Descriptor: Port Ingress Rule Clause"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 13),
-        XByteField("clause", 2),
-        XByteField("fieldcode", 0),
-        XByteField("fieldinstance", 0),
-        XByteField("msbmask", 0),
-        XByteField("lsbmask", 0),
-        XByteField("operator", 0),
-        XByteField("matchlength", 6),
-        XByteField("match0", 0x01),
-        XByteField("match1", 0x80),
-        XByteField("match2", 0xc2),
-        XByteField("match3", 0x00),
-        XByteField("match4", 0x00),
-        XByteField("match5", 0x00),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 13),
+                   XByteField("clause", 2),
+                   XByteField("fieldcode", 0),
+                   XByteField("fieldinstance", 0),
+                   XByteField("msbmask", 0),
+                   XByteField("lsbmask", 0),
+                   XByteField("operator", 0),
+                   XByteField("matchlength", 6),
+                   XByteField("match0", 0x01),
+                   XByteField("match1", 0x80),
+                   XByteField("match2", 0xc2),
+                   XByteField("match3", 0x00),
+                   XByteField("match4", 0x00),
+                   XByteField("match5", 0x00),
+                   ]
 
 class PortIngressRuleResultForward(Packet):
     """ Variable Descriptor: Port Ingress Rule Result Forward """
     name = "Variable Descriptor: Port Ingress Rule Result Forward"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 2),
-        XByteField("result", 3),
-        XByteField("forward", 2),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 2),
+                   XByteField("result", 3),
+                   XByteField("forward", 2),
+                   ]
 
 class PortIngressRuleResultDiscard(Packet):
     """ Variable Descriptor: Port Ingress Rule Result Discard """
     name = "Variable Descriptor: Port Ingress Rule Result Discard"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 2),
-        XByteField("result", 3),
-        XByteField("discard", 1),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 2),
+                   XByteField("result", 3),
+                   XByteField("discard", 1),
+                   ]
 
 class PortIngressRuleResultQueue(Packet):
     """ Variable Descriptor: Port Ingress Rule Result Queue """
     name = "Variable Descriptor: Port Ingress Rule Result Queue"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 6),
-        XByteField("result", 3),
-        XByteField("queuerule", 3),
-        XShortField("objecttype", 0x0000),
-        XByteField("instance", 0),
-        XByteField("queuenum", 0),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 6),
+                   XByteField("result", 3),
+                   XByteField("queuerule", 3),
+                   XShortField("objecttype", 0x0000),
+                   XByteField("instance", 0),
+                   XByteField("queuenum", 0),
+                   ]
+
+# __TIBIT_OLT_OAM__: Defined by Tibit
+class PortIngressRuleResultOLTQueue(Packet):
+    """ Variable Descriptor: Port Ingress Rule Result OLT Queue """
+    name = "Variable Descriptor: Port Ingress Rule Result OLT Queue"
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 15),
+                   XByteField("result", 3),
+                   XByteField("oltqueuerule", 0x13),
+                   XShortField("objecttype", 0x0001),
+                   XByteField("instance", 0),
+                   XByteField("pon", 0),
+                   StrField("unicastvssn", "TBIT"),
+                   XIntField("unicastlink", 0xe2222900),
+                   XByteField("pad", 0),
+                   ]
+
+# __TIBIT_OLT_OAM__: Defined by Tibit
+class PortIngressRuleResultOLTBroadcastQueue(Packet):
+    """ Variable Descriptor: Port Ingress Rule Result OLT Broadcast Queue """
+    name = "Variable Descriptor: Port Ingress Rule Result OLT Broadcast Queue"
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 15),
+                   XByteField("result", 3),
+                   XByteField("oltqueuerule", 0x13),
+                   XShortField("objecttype", 0x0001),
+                   XByteField("instance", 0),
+                   XByteField("pon", 0),
+                   XLongField("broadcast", 0xffffffffffff0000),
+                   XByteField("pad", 0),
+                   ]
 
 class PortIngressRuleResultSet(Packet):
     """ Variable Descriptor: Port Ingress Rule Result Set """
     name = "Variable Descriptor: Port Ingress Rule Result Set"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 8),
-        XByteField("result", 3),
-        XByteField("set", 4),
-        XByteField("fieldcode", 0),
-        XByteField("fieldinstance", 0),
-        XByteField("msbmask", 0),
-        XByteField("lsbmask", 0),
-        XShortField("value", 0),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 8),
+                   XByteField("result", 3),
+                   XByteField("set", 4),
+                   XByteField("fieldcode", 0),
+                   XByteField("fieldinstance", 0),
+                   XByteField("msbmask", 0),
+                   XByteField("lsbmask", 0),
+                   XShortField("value", 0),
+                   ]
+
+class PortIngressRuleResultCopy(Packet):
+    """ Variable Descriptor: Port Ingress Rule Result Copy """
+    name = "Variable Descriptor: Port Ingress Rule Result Copy"
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 6),
+                   XByteField("result", 3),
+                   XByteField("copy", 5),
+                   XByteField("fieldcode", 0),
+                   XByteField("fieldinstance", 0),
+                   XByteField("msbmask", 0),
+                   XByteField("lsbmask", 0),
+                   ]
+
+class PortIngressRuleResultDelete(Packet):
+    """ Variable Descriptor: Port Ingress Rule Result Delete """
+    name = "Variable Descriptor: Port Ingress Rule Result Delete"
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 4),
+                   XByteField("result", 3),
+                   XByteField("delete", 6),
+                   XByteField("fieldcode", 0),
+                   XByteField("instance", 0),
+                   ]
 
 class PortIngressRuleResultInsert(Packet):
     """ Variable Descriptor: Port Ingress Rule Result Insert """
     name = "Variable Descriptor: Port Ingress Rule Result Insert"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 4),
-        XByteField("result", 3),
-        XByteField("insert", 7),
-        XByteField("fieldcode", 0),
-        XByteField("fieldinstance", 0),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 4),
+                   XByteField("result", 3),
+                   XByteField("insert", 7),
+                   XByteField("fieldcode", 0),
+                   XByteField("fieldinstance", 0),
+                   ]
+
+class PortIngressRuleResultReplace(Packet):
+    """ Variable Descriptor: Port Ingress Rule Result Replace """
+    name = "Variable Descriptor: Port Ingress Rule Result Replace"
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 4),
+                   XByteField("result", 3),
+                   XByteField("replace", 8),
+                   XByteField("fieldcode", 0),
+                   XByteField("fieldinstance", 0),
+                   ]
 
 class PortIngressRuleTerminator(Packet):
     """ Variable Descriptor: Port Ingress Rule Terminator """
     name = "Variable Descriptor: Port Ingress Rule Terminator"
-    fields_desc = [
-        XByteField("branch", 0xD7),
-        XShortField("leaf", 0x0501),
-        ByteField("length", 1),
-        XByteField("terminator", 0),
-        ]
+    fields_desc = [XByteField("branch", 0xD7),
+                   XShortField("leaf", 0x0501),
+                   ByteField("length", 1),
+                   XByteField("terminator", 0),
+                   ]
 
 class CustomField(Packet):
     """ Variable Descriptor: Custom Field """