Beispiel #1
0
    def test_multicast_group_entry(self):
        mcge = sh.MulticastGroupEntry(1)
        mcge.add(1, 1).add(1, 2).add(2, 3)

        expected_entry = """
multicast_group_entry {
  multicast_group_id: 1
  replicas {
    egress_port: 1
    instance: 1
  }
  replicas {
    egress_port: 1
    instance: 2
  }
  replicas {
    egress_port: 2
    instance: 3
  }
}
"""

        mcge.insert()

        expected_req = self.make_write_request(
            p4runtime_pb2.Update.INSERT,
            P4RuntimeEntity.packet_replication_engine_entry, expected_entry)
        self.servicer.Write.assert_called_once_with(ProtoCmp(expected_req),
                                                    ANY)

        self.simple_read_check(expected_req.updates[0].entity, mcge,
                               P4RuntimeEntity.packet_replication_engine_entry)
Beispiel #2
0
 def test_multicast_group_entry_invalid(self):
     mcge = sh.MulticastGroupEntry()
     mcge.add(1, 1)
     with self.assertRaisesRegex(UserError, "0 is not a valid group_id"):
         mcge.insert()