Oops: 0000000096000004

This commit is contained in:
2026-04-10 00:41:11 +08:00
parent b8bc6a13cf
commit ee1f78f496
4 changed files with 73 additions and 14 deletions

View File

@@ -225,15 +225,50 @@ RUN set -eux; \
# Create a structured staging area
mkdir -p /tmp/fmc_staging/config; \
\
# Copy main files to the root of staging
# Copy main files
cp "$XML_SRC" /tmp/fmc_staging/config.xml; \
# Copy the HXS and schemas into the 'config' subfolder where fmc expects them
cp "$HXS_FILE" /tmp/fmc_staging/config/; \
cp "$SCHEMA_DIR"/*.xsd /tmp/fmc_staging/config/; \
\
# Production Cleanup (Remove MAC 3 from the main config)
# Production Cleanup: Remove RJ45 ports (MAC 3, 4, 5, 6) from the FMC config
# This ensures FMC only touches the SFP ports (MAC 9, 10)
sed -i '/<macport name="fm0-gb3"/{N;N;N;N;d;}' /tmp/fmc_staging/config.xml; \
cp /tmp/fmc_staging/config.xml /tmp/fmc_staging/policy.xml
sed -i '/<macport name="fm0-gb4"/{N;N;N;N;d;}' /tmp/fmc_staging/config.xml; \
sed -i '/<macport name="fm0-gb5"/{N;N;N;N;d;}' /tmp/fmc_staging/config.xml; \
sed -i '/<macport name="fm0-gb6"/{N;N;N;N;d;}' /tmp/fmc_staging/config.xml; \
\
# Also remove the port bindings for those MACs
sed -i '/<port type="MAC" number="3"/d' /tmp/fmc_staging/config.xml; \
sed -i '/<port type="MAC" number="4"/d' /tmp/fmc_staging/config.xml; \
sed -i '/<port type="MAC" number="5"/d' /tmp/fmc_staging/config.xml; \
sed -i '/<port type="MAC" number="6"/d' /tmp/fmc_staging/config.xml; \
\
# 1. Initialize policy.xml with the correct <netpcd> root tag
echo '<?xml version="1.0" encoding="UTF-8"?>' > /tmp/fmc_staging/policy.xml; \
echo '<netpcd>' >> /tmp/fmc_staging/policy.xml; \
\
# 2. Extract policy names and generate dummy blocks
# We use a subshell and tr to handle potential weird spacing
POLICY_NAMES=$(grep -o 'policy="[^"]*"' /tmp/fmc_staging/config.xml | cut -d'"' -f2 | sort -u); \
\
for NAME in $POLICY_NAMES; do \
echo " <policy name=\"$NAME\">" >> /tmp/fmc_staging/policy.xml; \
echo " <dist_order><distributionref name=\"dist_dummy\"/></dist_order>" >> /tmp/fmc_staging/policy.xml; \
echo " </policy>" >> /tmp/fmc_staging/policy.xml; \
done; \
\
# 3. Append the distribution and close the root tag
# Updated Distribution block for the Dockerfile RUN command
cat << 'EOF' >> /tmp/fmc_staging/policy.xml
<distribution name="dist_dummy">
<protocols><protocolref name="ethernet"/></protocols>
<standardhash>
<algorithm name="fms_hash_default"/>
</standardhash>
<keycount>1</keycount>
</distribution>
</netpcd>
EOF
RUN set -eux; \
cd /src/vpp; \