fix regex expression to find IPV4 address
[samplevnf.git] / VNFs / DPPD-PROX / helper-scripts / rapid / createrapidk8s.py
1 #!/usr/bin/env python3
2
3 ##
4 ## Copyright (c) 2019 Intel Corporation
5 ##
6 ## Licensed under the Apache License, Version 2.0 (the "License");
7 ## you may not use this file except in compliance with the License.
8 ## You may obtain a copy of the License at
9 ##
10 ##     http://www.apache.org/licenses/LICENSE-2.0
11 ##
12 ## Unless required by applicable law or agreed to in writing, software
13 ## distributed under the License is distributed on an "AS IS" BASIS,
14 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ## See the License for the specific language governing permissions and
16 ## limitations under the License.
17 ##
18
19 import argparse
20 from rapid_k8s_deployment import K8sDeployment
21
22 # Config file name for deployment creation
23 CREATE_CONFIG_FILE_NAME = "rapid.pods"
24
25 # Config file name for runrapid script
26 RUN_CONFIG_FILE_NAME = "rapid.env"
27
28 def main():
29     # Parse command line arguments
30     argparser = argparse.ArgumentParser()
31     argparser.add_argument("-c", "--clean", action = "store_true",
32                            help = "Terminate pod-rapid-* PODs. "
33                            "Clean up cluster before or after the testing.")
34     args = argparser.parse_args()
35
36     # Create a new deployment
37     deployment = K8sDeployment()
38
39     # Load config file with test environment description
40     deployment.load_create_config(CREATE_CONFIG_FILE_NAME)
41
42     if args.clean:
43         deployment.delete_pods()
44         return
45
46     # Create PODs for test
47     deployment.create_pods()
48
49     # Save config file for runrapid script
50     deployment.save_runtime_config(RUN_CONFIG_FILE_NAME)
51
52 if __name__ == "__main__":
53     main()