Loading src/policy/src/main/java/eu/teraflow/policy/common/Util.java +16 −0 Original line number Original line Diff line number Diff line /* * Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package eu.teraflow.policy.common; package eu.teraflow.policy.common; import java.util.List; import java.util.List; Loading src/policy/src/main/java/eu/teraflow/policy/context/ContextGatewayImpl.java +5 −18 Original line number Original line Diff line number Diff line Loading @@ -28,13 +28,10 @@ import io.quarkus.grpc.GrpcClient; import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.inject.Inject; import org.jboss.logging.Logger; @ApplicationScoped @ApplicationScoped public class ContextGatewayImpl implements ContextGateway { public class ContextGatewayImpl implements ContextGateway { private static final Logger LOGGER = Logger.getLogger(ContextGatewayImpl.class); @GrpcClient("context") @GrpcClient("context") MutinyContextServiceStub streamingDelegateContext; MutinyContextServiceStub streamingDelegateContext; Loading @@ -55,8 +52,6 @@ public class ContextGatewayImpl implements ContextGateway { final var serializedServiceId = serializer.serialize(serviceId); final var serializedServiceId = serializer.serialize(serviceId); LOGGER.infof("getService = %s", serializedServiceId); return streamingDelegateContext return streamingDelegateContext .getService(serializedServiceId) .getService(serializedServiceId) .onItem() .onItem() Loading Loading @@ -97,19 +92,11 @@ public class ContextGatewayImpl implements ContextGateway { public Uni<String> setPolicyRule(PolicyRule policyRule) { public Uni<String> setPolicyRule(PolicyRule policyRule) { // return Uni.createFrom().item("571eabc1-0f59-48da-b608-c45876c3fa8a"); // return Uni.createFrom().item("571eabc1-0f59-48da-b608-c45876c3fa8a"); final var serializedPolicyRuleBasic = serializer.serialize(policyRule); final var serializedPolicyRuleBasic = serializer.serialize(policyRule); LOGGER.infof("Inside setPolicyRule"); var ret = return streamingDelegateContextPolicy streamingDelegateContextPolicy .setPolicyRule(serializedPolicyRuleBasic) .setPolicyRule(serializedPolicyRuleBasic) .onItem() .onItem() .transform(serializer::deserialize); .transform(serializer::deserialize); ret.subscribe() .with( x -> { LOGGER.infof(x); }); return ret; } } @Override @Override Loading Loading
src/policy/src/main/java/eu/teraflow/policy/common/Util.java +16 −0 Original line number Original line Diff line number Diff line /* * Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package eu.teraflow.policy.common; package eu.teraflow.policy.common; import java.util.List; import java.util.List; Loading
src/policy/src/main/java/eu/teraflow/policy/context/ContextGatewayImpl.java +5 −18 Original line number Original line Diff line number Diff line Loading @@ -28,13 +28,10 @@ import io.quarkus.grpc.GrpcClient; import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.Uni; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.inject.Inject; import org.jboss.logging.Logger; @ApplicationScoped @ApplicationScoped public class ContextGatewayImpl implements ContextGateway { public class ContextGatewayImpl implements ContextGateway { private static final Logger LOGGER = Logger.getLogger(ContextGatewayImpl.class); @GrpcClient("context") @GrpcClient("context") MutinyContextServiceStub streamingDelegateContext; MutinyContextServiceStub streamingDelegateContext; Loading @@ -55,8 +52,6 @@ public class ContextGatewayImpl implements ContextGateway { final var serializedServiceId = serializer.serialize(serviceId); final var serializedServiceId = serializer.serialize(serviceId); LOGGER.infof("getService = %s", serializedServiceId); return streamingDelegateContext return streamingDelegateContext .getService(serializedServiceId) .getService(serializedServiceId) .onItem() .onItem() Loading Loading @@ -97,19 +92,11 @@ public class ContextGatewayImpl implements ContextGateway { public Uni<String> setPolicyRule(PolicyRule policyRule) { public Uni<String> setPolicyRule(PolicyRule policyRule) { // return Uni.createFrom().item("571eabc1-0f59-48da-b608-c45876c3fa8a"); // return Uni.createFrom().item("571eabc1-0f59-48da-b608-c45876c3fa8a"); final var serializedPolicyRuleBasic = serializer.serialize(policyRule); final var serializedPolicyRuleBasic = serializer.serialize(policyRule); LOGGER.infof("Inside setPolicyRule"); var ret = return streamingDelegateContextPolicy streamingDelegateContextPolicy .setPolicyRule(serializedPolicyRuleBasic) .setPolicyRule(serializedPolicyRuleBasic) .onItem() .onItem() .transform(serializer::deserialize); .transform(serializer::deserialize); ret.subscribe() .with( x -> { LOGGER.infof(x); }); return ret; } } @Override @Override Loading