Skip to content
Snippets Groups Projects
Commit fbff9d56 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Pre-merge code cleanup

parent 6eb0f6a9
No related branches found
No related tags found
2 merge requests!142Release TeraFlowSDN 2.1,!121Add Policy component serializer extensions
#!/bin/bash
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# 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.
PROJECTDIR=`pwd`
RCFILE=$PROJECTDIR/coverage/.coveragerc
COVERAGEFILE=$PROJECTDIR/coverage/.coverage
# Configure the correct folder on the .coveragerc file
cat $PROJECTDIR/coverage/.coveragerc.template | sed s+~/teraflow/controller+$PROJECTDIR/src+g > $RCFILE
# Destroy old coverage file
rm -f $COVERAGEFILE
source tfs_runtime_env_vars.sh
# Force a flush of Context database
kubectl --namespace $TFS_K8S_NAMESPACE exec -it deployment/contextservice --container redis -- redis-cli FLUSHALL
# Run functional tests
pytest --log-level=INFO --verbose \
src/tests/ofc22/tests/test_functional_bootstrap.py
pytest --log-level=INFO --verbose \
src/tests/ofc22/tests/test_functional_create_service.py
pytest --log-level=INFO --verbose \
src/tests/ofc22/tests/test_functional_delete_service.py
pytest --log-level=INFO --verbose \
src/tests/ofc22/tests/test_functional_cleanup.py
import grpc from 'k6/net/grpc';
import exec from "k6/execution";
import { check, sleep } from 'k6';
const client = new grpc.Client();
client.load(['../proto'], 'policy.proto');
export const data = [];
for (let i = 1; i < 11; i++) {
data.push(
{
"serviceId": {
"context_id": {
"context_uuid": {"uuid": "admin"}
},
"service_uuid": {
"uuid": "24699610-770e-411f-9fac-c37631eea8e4"
}
},
"policyRuleBasic": {
"policyRuleId": {"uuid": {"uuid": "2"}},
"policyRuleState": {"policyRuleState": "POLICY_ACTIVE"},
"priority": 0,
"conditionList": [{"kpiId": {"kpi_id": {"uuid": i.toString()}},
"numericalOperator": "POLICYRULE_CONDITION_NUMERICAL_EQUAL",
"kpiValue": {"boolVal": false}
}],
"actionList": [{}],
"booleanOperator": "POLICYRULE_CONDITION_BOOLEAN_OR"
}
}
);
};
export const options = {
scenarios :{
"AddPolicy-scenario": {
executor: "shared-iterations",
vus: 1,
iterations: data.length,
maxDuration: "1h"
}
}
};
export default () => {
client.connect('10.1.90.119:6060', {
plaintext: true,
timeout: 10000
});
var item = data[exec.scenario.iterationInInstance];
const response = client.invoke('policy.PolicyService/PolicyAddService', item);
check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
});
console.log(JSON.stringify(response.message));
client.close();
sleep(1);
};
export function handleSummary(data) {
return {
'summary.json': JSON.stringify(data.metrics.grpc_req_duration.values), //the default data object
};
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment