diff --git a/src/forecaster/tests/data/README.md b/src/forecaster/tests/data/README.md index 32f0b320c14620fee507115d78fa8494b0cfae52..045dd900ccc970fcf56a5b49f9e6244fe65692b8 100644 --- a/src/forecaster/tests/data/README.md +++ b/src/forecaster/tests/data/README.md @@ -1,6 +1,20 @@ # Manual Forecaster test: -- Edit `my_deploy.sh` and enable the `monitoring` and the `forecaster` components. +- Move to root folder: +```bash +cd ~/tfs-ctrl +``` + +- Edit `my_deploy.sh` and enable the `monitoring` and the `forecaster` components: +```bash +export TFS_COMPONENTS="context device monitoring forecaster pathcomp service slice compute webui load_generator" +``` + +- Edit `deploy/tfs.sh` and disable linkerd injection to capture unencrypted traffic. +```bash +cp ./manifests/"${COMPONENT}"service.yaml "$MANIFEST" +#cat ./manifests/"${COMPONENT}"service.yaml | linkerd inject - --proxy-cpu-request "10m" --proxy-cpu-limit "1" --proxy-memory-request "64Mi" --proxy-memory-limit "256Mi" > "$MANIFEST" +``` - Deploy TeraFlowSDN controller: ```bash @@ -16,4 +30,14 @@ source tfs_runtime_env_vars.sh python src/forecaster/tests/data/inject_samples.py ``` +- Start wireshark capture: +```bash +tshark -i any -f "tcp port not 22 and tcp port not 16443" -w capture.pcap +``` + - Onboard the service descriptor `service.json` through the WebUI. + +- Wireshark display filter: +``` +(ip.addr==10.152.183.0/24 or ip.addr==10.0.2.10) and tcp.port!=443 and tcp.port!=26257 and tcp.port!=3000 and tcp.port!=9990 and tcp.port!=8089 and tcp.port!=16443 and tcp.port!=10250 and tcp.port!=10254 and tcp.port!=4191 and tcp.port!=9090 and tcp.port!=9994 and tcp.port!=9995 and tcp.port!=9996 and tcp.port!=9997 and tcp.port!=9998 and tcp.port!=4443 and tcp.port!=8181 +``` diff --git a/src/pathcomp/frontend/service/TopologyTools.py b/src/pathcomp/frontend/service/TopologyTools.py index b66fa13dd32731a0611c7683b858be2019cdb480..778cd59acce1eeeeeb1b05bcc3a03f09a9a46a8e 100644 --- a/src/pathcomp/frontend/service/TopologyTools.py +++ b/src/pathcomp/frontend/service/TopologyTools.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math +import logging, math from typing import Dict, Optional from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME, ServiceNameEnum from common.Settings import ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, find_environment_variables, get_env_var_name @@ -25,6 +25,8 @@ from common.tools.grpc.Tools import grpc_message_to_json_string from context.client.ContextClient import ContextClient from forecaster.client.ForecasterClient import ForecasterClient +LOGGER = logging.getLogger(__name__) + def get_service_schedule(service : Service) -> Optional[Constraint_Schedule]: for constraint in service.service_constraints: if constraint.WhichOneof('constraint') != 'schedule': continue @@ -40,12 +42,8 @@ def get_pathcomp_topology_details(request : PathCompRequest, allow_forecasting : if len(request.services) == 0: raise InvalidArgumentException('services', grpc_message_to_json_string(request), 'must not be empty') - if len(request.services) > 1: - # Forecaster does not support multiple services - return topology_details - if not allow_forecasting: - # Forecaster explicitly disabled + LOGGER.warning('Forecaster is explicitly disabled') return topology_details env_vars = find_environment_variables([ @@ -53,19 +51,23 @@ def get_pathcomp_topology_details(request : PathCompRequest, allow_forecasting : get_env_var_name(ServiceNameEnum.FORECASTER, ENVVAR_SUFIX_SERVICE_PORT_GRPC), ]) if len(env_vars) != 2: - # Forecaster not available + LOGGER.warning('Forecaster is not deployed') + return topology_details + + if len(request.services) > 1: + LOGGER.warning('Forecaster does not support multiple services') return topology_details service = request.services[0] service_schedule = get_service_schedule(service) if service_schedule is None: - # Service provides no schedule constraint, so forecast cannot be computed + LOGGER.warning('Service provides no schedule constraint; forecast cannot be used') return topology_details #start_timestamp = service_schedule.start_timestamp duration_days = service_schedule.duration_days - if float(duration_days) > 0.0: - # Service provides no scheduled duration, so forecast cannot be computed + if float(duration_days) <= 1.e-12: + LOGGER.warning('Service schedule constraint does not define a duration; forecast cannot be used') return topology_details forecaster_client = ForecasterClient()