File: SoftLayer_Network_SecurityGroup.py

package info (click to toggle)
python-softlayer 6.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,508 kB
  • sloc: python: 57,195; makefile: 133; xml: 97; sh: 59
file content (53 lines) | stat: -rw-r--r-- 1,831 bytes parent folder | download | duplicates (3)
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
getAllObjects = [
    {'id': 100,
     'name': 'secgroup1',
     'description': 'Securitygroup1'},
    {'id': 104,
     'name': 'secgroup2'},
    {'id': 110}
]

getRules = [
    {'id': 100,
     'direction': 'egress',
     'ethertype': 'IPv4'}
]

guest_dict = {'id': 5000,
              'hostname': 'test',
              'primaryBackendIpAddress': '10.3.4.5',
              'primaryIpAddress': '169.23.123.43'}

getObject = {
    'id': 100,
    'name': 'secgroup1',
    'description': 'Securitygroup1',
    'networkComponentBindings': [{'networkComponentId': 1000,
                                  'networkComponent': {'id': 1000,
                                                       'port': 0,
                                                       'guest': guest_dict}},
                                 {'networkComponentId': 1001,
                                  'networkComponent': {'id': 1001,
                                                       'port': 1,
                                                       'guest': guest_dict}}],
    'rules': getRules
}

createObject = {'id': 100,
                'name': 'secgroup1',
                'description': 'Securitygroup1',
                'createDate': '2017-05-05T12:44:43-06:00'}
editObject = True
deleteObject = True
addRules = {"requestId": "addRules",
            "rules": "[{'direction': 'ingress', "
                     "'portRangeMax': '', "
                     "'portRangeMin': '', "
                     "'ethertype': 'IPv4', "
                     "'securityGroupId': 100, "
                     "'remoteGroupId': '', "
                     "'id': 100}]"}
editRules = {'requestId': 'editRules'}
removeRules = {'requestId': 'removeRules'}
attachNetworkComponents = {'requestId': 'interfaceAdd'}
detachNetworkComponents = {'requestId': 'interfaceRemove'}