summaryrefslogtreecommitdiffstats
path: root/testcases/vIMS/CI/clearwater.py
blob: 7236f4fba13128d2da6c1833dd7abe473a3f8839 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/python
# coding: utf8
#######################################################################
#
#   Copyright (c) 2015 Orange
#   valentin.boucher@orange.com
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
########################################################################


class clearwater:

    def __init__(self, inputs={}, orchestrator=None, logger=None):
        self.config = inputs
        self.orchestrator = orchestrator
        self.logger = logger
        self.deploy = False

    def set_orchestrator(self, orchestrator):
        self.orchestrator = orchestrator

    def set_flavor_id(self, flavor_id):
        self.config['flavor_id'] = flavor_id

    def set_image_id(self, image_id):
        self.config['image_id'] = image_id

    def set_agent_user(self, agent_user):
        self.config['agent_user'] = agent_user

    def set_external_network_name(self, external_network_name):
        self.config['external_network_name'] = external_network_name

    def set_public_domain(self, public_domain):
        self.config['public_domain'] = public_domain

    def deploy_vnf(self, blueprint, bp_name='clearwater',
                   dep_name='clearwater-opnfv'):
        if self.orchestrator:
            self.dep_name = dep_name
            error = self.orchestrator.download_upload_and_deploy_blueprint(
                blueprint, self.config, bp_name, dep_name)
            if error:
                return error

            self.deploy = True

        else:
            if self.logger:
                self.logger.error("Cloudify manager is down or not provide...")

    def undeploy_vnf(self):
        if self.orchestrator:
            if self.deploy:
                self.deploy = False
                self.orchestrator.undeploy_deployment(self.dep_name)
            else:
                if self.logger:
                    self.logger.error("Clearwater isn't already deploy...")
        else:
            if self.logger:
                self.logger.error("Cloudify manager is down or not provide...")
n>1; __u8 message_type:4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 message_type:4; __u8 double_wide:1; __u8 fc:3; #endif __u8 dest_switch_addr[3]; #if defined (__BIG_ENDIAN_BITFIELD) __u8 dest_addr_type:4, src_addr_type:4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 src_addr_type:4, dest_addr_type:4; #endif __u8 src_switch_addr[3]; __u16 reserved; __u8 daddr[HIPPI_ALEN]; __u16 locally_administered; __u8 saddr[HIPPI_ALEN]; } __attribute__((packed)); #define HIPPI_OUI_LEN 3 /* * Looks like the dsap and ssap fields have been swapped by mistake in * RFC 2067 "IP over HIPPI". */ struct hippi_snap_hdr { __u8 dsap; /* always 0xAA */ __u8 ssap; /* always 0xAA */ __u8 ctrl; /* always 0x03 */ __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ __be16 ethertype; /* packet type ID field */ } __attribute__((packed)); struct hippi_hdr { struct hippi_fp_hdr fp; struct hippi_le_hdr le; struct hippi_snap_hdr snap; } __attribute__((packed)); #endif /* _LINUX_IF_HIPPI_H */