### Question:
IngressFlowModFactory { public OFFlowMod makeOuterVlanMatchSharedMessage() { FlowEndpoint endpoint = command.getEndpoint(); FlowSharedSegmentCookie cookie = FlowSharedSegmentCookie.builder(SharedSegmentType.QINQ_OUTER_VLAN) .portNumber(endpoint.getPortNumber()) .vlanId(endpoint.getOuterVlanId()) .build(); return flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.PRE_INGRESS_TABLE_ID)) .setCookie(U64.of(cookie.getValue())) .setMatch(of.buildMatch() .setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())) .setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(endpoint.getOuterVlanId())) .build()) .setInstructions(makeOuterVlanMatchInstructions()) .build(); } IngressFlowModFactory(
            OfFlowModBuilderFactory flowModBuilderFactory, IngressFlowSegmentBase command, IOFSwitch sw,
            Set<SwitchFeature> features); OFFlowMod makeOuterOnlyVlanForwardMessage(MeterId effectiveMeterId); OFFlowMod makeSingleVlanForwardMessage(MeterId effectiveMeterId); OFFlowMod makeDoubleVlanForwardMessage(MeterId effectiveMeterId); OFFlowMod makeDefaultPortForwardMessage(MeterId effectiveMeterId); OFFlowMod makeOuterVlanMatchSharedMessage(); OFFlowMod makeOuterOnlyVlanServer42IngressFlowMessage(int server42UpdPortOffset); OFFlowMod makeDefaultPortServer42IngressFlowMessage(int server42UpdPortOffset); OFFlowMod makeCustomerPortSharedCatchMessage(); OFFlowMod makeLldpInputCustomerFlowMessage(); OFFlowMod makeArpInputCustomerFlowMessage(); Optional<OFFlowMod> makeServer42InputFlowMessage(int server42UpdPortOffset);  }### Answer:
@Test public void makeOuterVlanMatchSharedMessage() { final IngressFlowModFactory factory = makeFactory(); final IngressFlowSegmentBase command = factory.getCommand(); final FlowEndpoint endpoint = command.getEndpoint(); RoutingMetadata metadata = RoutingMetadata.builder() .outerVlanId(endpoint.getOuterVlanId()) .build(Collections.emptySet()); OFFlowAdd expected = of.buildFlowAdd() .setTableId(getTargetPreIngressTableId()) .setPriority(FlowSegmentCommand.FLOW_PRIORITY) .setCookie(U64.of( FlowSharedSegmentCookie.builder(SharedSegmentType.QINQ_OUTER_VLAN) .portNumber(endpoint.getPortNumber()) .vlanId(endpoint.getOuterVlanId()) .build().getValue())) .setMatch(OfAdapter.INSTANCE.matchVlanId(of, of.buildMatch(), endpoint.getOuterVlanId()) .setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())) .build()) .setInstructions(ImmutableList.of( of.instructions().applyActions(Collections.singletonList(of.actions().popVlan())), of.instructions().writeMetadata(metadata.getValue(), metadata.getMask()), of.instructions().gotoTable(TableId.of(SwitchManager.INGRESS_TABLE_ID)))) .build(); verifyOfMessageEquals(expected, factory.makeOuterVlanMatchSharedMessage()); }