Refactored fabric PipeconfLoader to automatically build pipeconfs
Fabric.p4 is evolving in a way that will allow multiple profiles (e.g.
fabric, fabric-spgw, fabric-int, etc). Moreover, we need to support
multiple targets (e.g. BMv2, Tofino, etc.) as well as platforms
(variant of a target). Maintaining a pipeconf for each
profile/target/platform is time-consuming.
The new PipeconfLoader automatically builds pipeconfs based on the
available p4c compiler outputs available in the 'resources' directory.
This approach removes the need to maintain separate pipeconfs like
fabric-pro. Those interested in using fabric.p4 with targets other than
BMv2, will simply need to place the appropriate target/platform-specific
P4 compiler outputs in the resource directory.
Change-Id: I58d208a1837e747357373b2296cb950f13799ed6
diff --git a/pipelines/fabric/src/main/resources/Makefile b/pipelines/fabric/src/main/resources/Makefile
index c3016f8..0528576 100644
--- a/pipelines/fabric/src/main/resources/Makefile
+++ b/pipelines/fabric/src/main/resources/Makefile
@@ -1,23 +1,10 @@
-BMV2_CPU_PORT=255
+all: fabric fabric-spgw
-BMV2_OPTIONS=-DTARGET_BMV2 -DCPU_PORT=$(BMV2_CPU_PORT)
+fabric:
+ @./bmv2-compile.sh "fabric" ""
-all: bmv2 bmv2-spgw
-
-bmv2: makedir
- p4c-bm2-ss --arch v1model -o p4c-out/bmv2/fabric.json \
- $(BMV2_OPTIONS) \
- --p4runtime-file p4c-out/bmv2/fabric.p4info \
- --p4runtime-format text fabric.p4
-
-bmv2-spgw: makedir
- p4c-bm2-ss --arch v1model -o p4c-out/bmv2/fabric-spgw.json \
- $(BMV2_OPTIONS) -DWITH_SPGW \
- --p4runtime-file p4c-out/bmv2/fabric-spgw.p4info \
- --p4runtime-format text fabric.p4
-
-makedir:
- mkdir -p p4c-out/bmv2
+fabric-spgw:
+ @./bmv2-compile.sh "fabric-spgw" "-DWITH_SPGW"
clean:
- rm -rf p4c-out/bmv2/*
+ rm -rf p4c-out/*/bmv2