Introduce Pi Register model to PI Framework
Change-Id: I7fae87d5b5ed5fff34b3addfc148cee6fc98137c
diff --git a/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4PipelineModelTest.java b/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4PipelineModelTest.java
index 918e6e8..84d3af8 100644
--- a/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4PipelineModelTest.java
+++ b/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4PipelineModelTest.java
@@ -41,6 +41,8 @@
import org.onosproject.net.pi.model.PiPacketOperationModel;
import org.onosproject.net.pi.model.PiPacketOperationType;
import org.onosproject.net.pi.model.PiPipelineModel;
+import org.onosproject.net.pi.model.PiRegisterId;
+import org.onosproject.net.pi.model.PiRegisterModel;
import org.onosproject.net.pi.model.PiTableId;
import org.onosproject.net.pi.model.PiTableModel;
import org.onosproject.net.pi.model.PiTableType;
@@ -142,6 +144,25 @@
.put(PI_METER_ID_2, P4_METER_MODEL_2)
.build();
+ /* Registers */
+ private static final PiRegisterId PI_REGISTER_ID_1 = PiRegisterId.of("Register1");
+ private static final PiRegisterId PI_REGISTER_ID_2 = PiRegisterId.of("Register2");
+
+ private static final long REGISTER_SIZE_1 = 1000;
+ private static final long REGISTER_SIZE_2 = 2000;
+
+ private static final P4RegisterModel P4_REGISTER_MODEL_1 = new P4RegisterModel(PI_REGISTER_ID_1, REGISTER_SIZE_1);
+ private static final P4RegisterModel P4_REGISTER_MODEL_2 = new P4RegisterModel(PI_REGISTER_ID_2, REGISTER_SIZE_2);
+
+ private static final ImmutableMap<PiRegisterId, PiRegisterModel> REGISTERS_1 =
+ new ImmutableMap.Builder<PiRegisterId, PiRegisterModel>()
+ .put(PI_REGISTER_ID_1, P4_REGISTER_MODEL_1)
+ .build();
+ private static final ImmutableMap<PiRegisterId, PiRegisterModel> REGISTERS_2 =
+ new ImmutableMap.Builder<PiRegisterId, PiRegisterModel>()
+ .put(PI_REGISTER_ID_2, P4_REGISTER_MODEL_2)
+ .build();
+
/* Match Fields */
private static final PiMatchFieldId PI_MATCH_FIELD_ID_1 = PiMatchFieldId.of("MatchField1");
private static final PiMatchFieldId PI_MATCH_FIELD_ID_2 = PiMatchFieldId.of("MatchField2");
@@ -315,11 +336,11 @@
.build();
private static final PiPipelineModel P4_PIPELINE_MODEL_1 =
- new P4PipelineModel(TABLES_1, COUNTERS_1, METERS_1, ACTION_PROFILES_1, PACKET_OPERATIONS_1);
+ new P4PipelineModel(TABLES_1, COUNTERS_1, METERS_1, REGISTERS_1, ACTION_PROFILES_1, PACKET_OPERATIONS_1);
private static final PiPipelineModel SAME_AS_P4_PIPELINE_MODEL_1 =
- new P4PipelineModel(TABLES_1, COUNTERS_1, METERS_1, ACTION_PROFILES_1, PACKET_OPERATIONS_1);
+ new P4PipelineModel(TABLES_1, COUNTERS_1, METERS_1, REGISTERS_1, ACTION_PROFILES_1, PACKET_OPERATIONS_1);
private static final PiPipelineModel P4_PIPELINE_MODEL_2 =
- new P4PipelineModel(TABLES_2, COUNTERS_2, METERS_2, ACTION_PROFILES_2, PACKET_OPERATIONS_2);
+ new P4PipelineModel(TABLES_2, COUNTERS_2, METERS_2, REGISTERS_1, ACTION_PROFILES_2, PACKET_OPERATIONS_2);
/**
* Checks that the P4PipelineModel class is immutable.