@Test public void testResolveRemovedChainAction_noParameterValue() { final PolicyConfigurationContext context = new PolicyConfigurationContext(); context.setPolicyMapLocation(getLocation()); final PeerEndpoint peerEndpoint = peerEndpointBuilder(); final Action action = actionBuilder(null); ServiceChainingUtil.resolveRemovedChainAction(peerEndpoint, sgtBuilder(10), sgtBuilder(20), resolvedActionBuilder(new RuleName("rule-name"), CHAIN, action, In), context); verifyNoMoreInteractions(policyWriterUtil); }
static void resolveRemovedChainAction(final PeerEndpoint peerEndpoint, final Sgt sourceSgt, final Sgt destinationSgt, final Map<ActionCase, ActionInDirection> actionMap, final PolicyConfigurationContext context) { final ActionInDirection actionInDirection = actionMap.get(ActionCase.CHAIN); final Action action = actionInDirection.getAction(); final EndpointPolicyParticipation participation = actionInDirection.getParticipation(); final Direction direction = actionInDirection.getDirection(); final ServiceFunctionPath servicePath = ServiceChainingUtil.findServicePathFromParameterValues(action.getParameterValue()); if (servicePath == null || servicePath.getName() == null) { return; } final TenantId tenantId = getTenantId(peerEndpoint); if (tenantId == null) { return; } if ((participation.equals(PROVIDER) && direction.equals(Out)) || (participation.equals(CONSUMER) && direction.equals(In))) { final RspName rspName = generateRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } else if (servicePath.isSymmetric()) { final RspName rspName = generateReversedRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } }
ServiceChainingUtil { static void resolveRemovedChainAction(final PeerEndpoint peerEndpoint, final Sgt sourceSgt, final Sgt destinationSgt, final Map<ActionCase, ActionInDirection> actionMap, final PolicyConfigurationContext context) { final ActionInDirection actionInDirection = actionMap.get(ActionCase.CHAIN); final Action action = actionInDirection.getAction(); final EndpointPolicyParticipation participation = actionInDirection.getParticipation(); final Direction direction = actionInDirection.getDirection(); final ServiceFunctionPath servicePath = ServiceChainingUtil.findServicePathFromParameterValues(action.getParameterValue()); if (servicePath == null || servicePath.getName() == null) { return; } final TenantId tenantId = getTenantId(peerEndpoint); if (tenantId == null) { return; } if ((participation.equals(PROVIDER) && direction.equals(Out)) || (participation.equals(CONSUMER) && direction.equals(In))) { final RspName rspName = generateRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } else if (servicePath.isSymmetric()) { final RspName rspName = generateReversedRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } } }
ServiceChainingUtil { static void resolveRemovedChainAction(final PeerEndpoint peerEndpoint, final Sgt sourceSgt, final Sgt destinationSgt, final Map<ActionCase, ActionInDirection> actionMap, final PolicyConfigurationContext context) { final ActionInDirection actionInDirection = actionMap.get(ActionCase.CHAIN); final Action action = actionInDirection.getAction(); final EndpointPolicyParticipation participation = actionInDirection.getParticipation(); final Direction direction = actionInDirection.getDirection(); final ServiceFunctionPath servicePath = ServiceChainingUtil.findServicePathFromParameterValues(action.getParameterValue()); if (servicePath == null || servicePath.getName() == null) { return; } final TenantId tenantId = getTenantId(peerEndpoint); if (tenantId == null) { return; } if ((participation.equals(PROVIDER) && direction.equals(Out)) || (participation.equals(CONSUMER) && direction.equals(In))) { final RspName rspName = generateRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } else if (servicePath.isSymmetric()) { final RspName rspName = generateReversedRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } } private  ServiceChainingUtil(); }
ServiceChainingUtil { static void resolveRemovedChainAction(final PeerEndpoint peerEndpoint, final Sgt sourceSgt, final Sgt destinationSgt, final Map<ActionCase, ActionInDirection> actionMap, final PolicyConfigurationContext context) { final ActionInDirection actionInDirection = actionMap.get(ActionCase.CHAIN); final Action action = actionInDirection.getAction(); final EndpointPolicyParticipation participation = actionInDirection.getParticipation(); final Direction direction = actionInDirection.getDirection(); final ServiceFunctionPath servicePath = ServiceChainingUtil.findServicePathFromParameterValues(action.getParameterValue()); if (servicePath == null || servicePath.getName() == null) { return; } final TenantId tenantId = getTenantId(peerEndpoint); if (tenantId == null) { return; } if ((participation.equals(PROVIDER) && direction.equals(Out)) || (participation.equals(CONSUMER) && direction.equals(In))) { final RspName rspName = generateRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } else if (servicePath.isSymmetric()) { final RspName rspName = generateReversedRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } } private  ServiceChainingUtil(); static boolean resolveRemoteSfcComponents(final RenderedServicePath renderedServicePath,
                                                      final PolicyConfigurationContext context); static RenderedServicePath resolveReversedRenderedServicePath(final ServiceFunctionPath sfp, final TenantId tenantId,
                                                                          final DataBroker dataBroker, final Sgt sourceSgt,
                                                                          final Sgt destinationSgt, final PolicyConfigurationContext context); @VisibleForTesting static void setTimeout(long value); }
ServiceChainingUtil { static void resolveRemovedChainAction(final PeerEndpoint peerEndpoint, final Sgt sourceSgt, final Sgt destinationSgt, final Map<ActionCase, ActionInDirection> actionMap, final PolicyConfigurationContext context) { final ActionInDirection actionInDirection = actionMap.get(ActionCase.CHAIN); final Action action = actionInDirection.getAction(); final EndpointPolicyParticipation participation = actionInDirection.getParticipation(); final Direction direction = actionInDirection.getDirection(); final ServiceFunctionPath servicePath = ServiceChainingUtil.findServicePathFromParameterValues(action.getParameterValue()); if (servicePath == null || servicePath.getName() == null) { return; } final TenantId tenantId = getTenantId(peerEndpoint); if (tenantId == null) { return; } if ((participation.equals(PROVIDER) && direction.equals(Out)) || (participation.equals(CONSUMER) && direction.equals(In))) { final RspName rspName = generateRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } else if (servicePath.isSymmetric()) { final RspName rspName = generateReversedRspName(servicePath, tenantId); resolveRemovedRenderedServicePath(rspName, sourceSgt, destinationSgt, context); } } private  ServiceChainingUtil(); static boolean resolveRemoteSfcComponents(final RenderedServicePath renderedServicePath,
                                                      final PolicyConfigurationContext context); static RenderedServicePath resolveReversedRenderedServicePath(final ServiceFunctionPath sfp, final TenantId tenantId,
                                                                          final DataBroker dataBroker, final Sgt sourceSgt,
                                                                          final Sgt destinationSgt, final PolicyConfigurationContext context); @VisibleForTesting static void setTimeout(long value);  }