Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | |
| 3 | import logging |
| 4 | from functools import wraps |
| 5 | LOG = logging.getLogger(__name__) |
Jiri Broulik | 5368cc5 | 2017-02-08 18:53:59 +0100 | [diff] [blame] | 6 | |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 7 | # Import third party libs |
| 8 | HAS_NEUTRON = False |
| 9 | try: |
| 10 | from neutronclient.v2_0 import client |
| 11 | HAS_NEUTRON = True |
| 12 | except ImportError: |
| 13 | pass |
| 14 | |
| 15 | __opts__ = {} |
| 16 | |
| 17 | |
| 18 | def __virtual__(): |
| 19 | ''' |
| 20 | Only load this module if neutron |
| 21 | is installed on this minion. |
| 22 | ''' |
| 23 | if HAS_NEUTRON: |
| 24 | return 'neutronng' |
| 25 | return False |
| 26 | |
| 27 | |
| 28 | def _autheticate(func_name): |
| 29 | ''' |
| 30 | Authenticate requests with the salt keystone module and format return data |
| 31 | ''' |
| 32 | @wraps(func_name) |
| 33 | def decorator_method(*args, **kwargs): |
| 34 | ''' |
| 35 | Authenticate request and format return data |
| 36 | ''' |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 37 | connection_args = {'profile': kwargs.pop('profile', None)} |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 38 | nkwargs = {} |
| 39 | for kwarg in kwargs: |
| 40 | if 'connection_' in kwarg: |
| 41 | connection_args.update({kwarg: kwargs[kwarg]}) |
| 42 | elif '__' not in kwarg: |
| 43 | nkwargs.update({kwarg: kwargs[kwarg]}) |
| 44 | kstone = __salt__['keystone.auth'](**connection_args) |
| 45 | token = kstone.auth_token |
Richard Felkl | aac256a | 2017-03-23 15:43:49 +0100 | [diff] [blame] | 46 | |
| 47 | if kwargs.get('connection_endpoint_type') == None: |
| 48 | endpoint_type = 'internalURL' |
| 49 | else: |
| 50 | endpoint_type = kwargs.get('connection_endpoint_type') |
| 51 | |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 52 | endpoint = kstone.service_catalog.url_for( |
| 53 | service_type='network', |
Richard Felkl | aac256a | 2017-03-23 15:43:49 +0100 | [diff] [blame] | 54 | endpoint_type=endpoint_type) |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 55 | neutron_interface = client.Client( |
| 56 | endpoint_url=endpoint, token=token) |
| 57 | return_data = func_name(neutron_interface, *args, **nkwargs) |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 58 | # TODO(vsaienko) drop this formatting when all commands are updated |
| 59 | # to return dictionary |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 60 | if isinstance(return_data, list): |
| 61 | # format list as a dict for rendering |
| 62 | return {data.get('name', None) or data['id']: data |
| 63 | for data in return_data} |
| 64 | return return_data |
| 65 | return decorator_method |
| 66 | |
| 67 | |
| 68 | @_autheticate |
| 69 | def list_floatingips(neutron_interface, **kwargs): |
| 70 | ''' |
| 71 | list all floatingips |
| 72 | CLI Example: |
| 73 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 74 | salt '*' neutronng.list_floatingips |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 75 | ''' |
| 76 | return neutron_interface.list_floatingips(**kwargs)['floatingips'] |
| 77 | |
| 78 | |
| 79 | @_autheticate |
| 80 | def list_security_groups(neutron_interface, **kwargs): |
| 81 | ''' |
| 82 | list all security_groups |
| 83 | CLI Example: |
| 84 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 85 | salt '*' neutronng.list_security_groups |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 86 | ''' |
| 87 | return neutron_interface.list_security_groups(**kwargs)['security_groups'] |
| 88 | |
| 89 | |
| 90 | @_autheticate |
| 91 | def list_subnets(neutron_interface, **kwargs): |
| 92 | ''' |
| 93 | list all subnets |
| 94 | CLI Example: |
| 95 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 96 | salt '*' neutronng.list_subnets |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 97 | ''' |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 98 | return neutron_interface.list_subnets(**kwargs) |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 99 | |
| 100 | |
| 101 | @_autheticate |
| 102 | def list_networks(neutron_interface, **kwargs): |
| 103 | ''' |
| 104 | list all networks |
| 105 | CLI Example: |
| 106 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 107 | salt '*' neutronng.list_networks |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 108 | ''' |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 109 | return neutron_interface.list_networks(**kwargs) |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 110 | |
| 111 | |
| 112 | @_autheticate |
| 113 | def list_ports(neutron_interface, **kwargs): |
| 114 | ''' |
| 115 | list all ports |
| 116 | CLI Example: |
| 117 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 118 | salt '*' neutronng.list_ports |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 119 | ''' |
| 120 | return neutron_interface.list_ports(**kwargs)['ports'] |
| 121 | |
| 122 | |
| 123 | @_autheticate |
| 124 | def list_routers(neutron_interface, **kwargs): |
| 125 | ''' |
| 126 | list all routers |
| 127 | CLI Example: |
| 128 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 129 | salt '*' neutronng.list_routers |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 130 | ''' |
| 131 | return neutron_interface.list_routers(**kwargs)['routers'] |
| 132 | |
| 133 | @_autheticate |
| 134 | def update_floatingip(neutron_interface, fip, port_id=None): |
| 135 | ''' |
| 136 | update floating IP. Should be used to associate and disassociate |
| 137 | floating IP with instance |
| 138 | CLI Example: |
| 139 | .. code-block:: bash |
| 140 | to associate with an instance's port |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 141 | salt '*' neutronng.update_floatingip openstack-floatingip-id port-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 142 | to disassociate from an instance's port |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 143 | salt '*' neutronng.update_floatingip openstack-floatingip-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 144 | ''' |
| 145 | neutron_interface.update_floatingip(fip, {"floatingip": |
| 146 | {"port_id": port_id}}) |
| 147 | |
| 148 | |
| 149 | @_autheticate |
| 150 | def update_subnet(neutron_interface, subnet_id, **subnet_params): |
| 151 | ''' |
| 152 | update given subnet |
| 153 | CLI Example: |
| 154 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 155 | salt '*' neutronng.update_subnet openstack-subnet-id name='new_name' |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 156 | ''' |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 157 | return neutron_interface.update_subnet(subnet_id, {'subnet': subnet_params}) |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 158 | |
| 159 | |
| 160 | @_autheticate |
| 161 | def update_network(neutron_interface, network_id, **net_params): |
| 162 | ''' |
| 163 | Update give network |
| 164 | CLI Example: |
| 165 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 166 | salt '*' neutronng.update_network openstack-net-id admin_state_up=false |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 167 | ''' |
| 168 | network_params = {} |
| 169 | for param in net_params: |
| 170 | if 'provider_' in param or 'router_' in param: |
| 171 | network_params[param.replace('_', ':', 1)] = net_params[param] |
| 172 | else: |
| 173 | network_params[param] = net_params[param] |
| 174 | LOG.info('ATTRIBUTES ' + str(network_params)) |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 175 | return neutron_interface.update_network(network_id, {'network': network_params}) |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 176 | |
| 177 | |
| 178 | @_autheticate |
| 179 | def update_router(neutron_interface, router_id, **router_params): |
| 180 | ''' |
| 181 | update given router |
| 182 | CLI Example: |
| 183 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 184 | salt '*' neutronng.update_router openstack-router-id name='new_name' |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 185 | external_gateway='openstack-network-id' administrative_state=true |
| 186 | ''' |
| 187 | neutron_interface.update_router(router_id, {'router': router_params}) |
| 188 | |
| 189 | |
| 190 | @_autheticate |
| 191 | def router_gateway_set(neutron_interface, router_id, external_gateway): |
| 192 | ''' |
| 193 | Set external gateway for a router |
| 194 | CLI Example: |
| 195 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 196 | salt '*' neutronng.update_router openstack-router-id openstack-network-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 197 | ''' |
| 198 | neutron_interface.update_router( |
| 199 | router_id, {'router': {'external_gateway_info': |
| 200 | {'network_id': external_gateway}}}) |
| 201 | |
| 202 | |
| 203 | @_autheticate |
| 204 | def router_gateway_clear(neutron_interface, router_id): |
| 205 | ''' |
| 206 | Clear external gateway for a router |
| 207 | CLI Example: |
| 208 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 209 | salt '*' neutronng.update_router openstack-router-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 210 | ''' |
| 211 | neutron_interface.update_router( |
| 212 | router_id, {'router': {'external_gateway_info': None}}) |
| 213 | |
| 214 | |
| 215 | @_autheticate |
| 216 | def create_router(neutron_interface, **router_params): |
| 217 | ''' |
| 218 | Create OpenStack Neutron router |
| 219 | CLI Example: |
| 220 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 221 | salt '*' neutronng.create_router name=R1 |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 222 | ''' |
| 223 | response = neutron_interface.create_router({'router': router_params}) |
| 224 | if 'router' in response and 'id' in response['router']: |
| 225 | return response['router']['id'] |
| 226 | |
| 227 | |
| 228 | @_autheticate |
| 229 | def router_add_interface(neutron_interface, router_id, subnet_id): |
| 230 | ''' |
| 231 | Attach router to a subnet |
| 232 | CLI Example: |
| 233 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 234 | salt '*' neutronng.router_add_interface openstack-router-id subnet-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 235 | ''' |
| 236 | neutron_interface.add_interface_router(router_id, {'subnet_id': subnet_id}) |
| 237 | |
| 238 | |
| 239 | @_autheticate |
| 240 | def router_rem_interface(neutron_interface, router_id, subnet_id): |
| 241 | ''' |
| 242 | Dettach router from a subnet |
| 243 | CLI Example: |
| 244 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 245 | salt '*' neutronng.router_rem_interface openstack-router-id subnet-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 246 | ''' |
| 247 | neutron_interface.remove_interface_router( |
| 248 | router_id, {'subnet_id': subnet_id}) |
| 249 | |
| 250 | |
| 251 | @_autheticate |
| 252 | def create_security_group(neutron_interface, **sg_params): |
| 253 | ''' |
| 254 | Create a new security group |
| 255 | CLI Example: |
| 256 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 257 | salt '*' neutronng.create_security_group name='new_rule' |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 258 | description='test rule' |
| 259 | ''' |
| 260 | response = neutron_interface.create_security_group( |
| 261 | {'security_group': sg_params}) |
| 262 | if 'security_group' in response and 'id' in response['security_group']: |
| 263 | return response['security_group']['id'] |
| 264 | |
| 265 | |
| 266 | @_autheticate |
| 267 | def create_security_group_rule(neutron_interface, **rule_params): |
| 268 | ''' |
| 269 | Create a rule entry for a security group |
| 270 | CLI Example: |
| 271 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 272 | salt '*' neutronng.create_security_group_rule |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 273 | ''' |
| 274 | neutron_interface.create_security_group_rule( |
| 275 | {'security_group_rule': rule_params}) |
| 276 | |
| 277 | |
| 278 | @_autheticate |
| 279 | def create_floatingip(neutron_interface, **floatingip_params): |
| 280 | ''' |
| 281 | Create a new floating IP |
| 282 | CLI Example: |
| 283 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 284 | salt '*' neutronng.create_floatingip floating_network_id=ext-net-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 285 | ''' |
| 286 | response = neutron_interface.create_floatingip( |
| 287 | {'floatingip': floatingip_params}) |
| 288 | if 'floatingip' in response and 'id' in response['floatingip']: |
Jiri Broulik | de2e290 | 2017-02-13 15:03:47 +0100 | [diff] [blame] | 289 | return response |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 290 | |
| 291 | |
| 292 | @_autheticate |
| 293 | def create_subnet(neutron_interface, **subnet_params): |
| 294 | ''' |
| 295 | Create a new subnet in OpenStack |
| 296 | CLI Example: |
| 297 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 298 | salt '*' neutronng.create_subnet name='subnet name' |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 299 | network_id='openstack-network-id' cidr='192.168.10.0/24' \\ |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 300 | gateway_ip='192.168.10.1' ip_version='4' enable_dhcp=false |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 301 | ''' |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 302 | return neutron_interface.create_subnet({'subnet': subnet_params}) |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 303 | |
| 304 | |
| 305 | @_autheticate |
| 306 | def create_network(neutron_interface, **net_params): |
| 307 | ''' |
| 308 | Create a new network segment in OpenStack |
| 309 | CLI Example: |
| 310 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 311 | salt '*' neutronng.create_network name=External |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 312 | provider_network_type=flat provider_physical_network=ext |
| 313 | ''' |
| 314 | network_params = {} |
| 315 | for param in net_params: |
| 316 | if 'provider_' in param or 'router_' in param: |
| 317 | network_params[param.replace('_', ':', 1)] = net_params[param] |
| 318 | else: |
| 319 | network_params[param] = net_params[param] |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 320 | return neutron_interface.create_network({'network': network_params}) |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 321 | |
| 322 | |
| 323 | @_autheticate |
| 324 | def create_port(neutron_interface, **port_params): |
| 325 | ''' |
| 326 | Create a new port in OpenStack |
| 327 | CLI Example: |
| 328 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 329 | salt '*' neutronng.create_port network_id='openstack-network-id' |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 330 | ''' |
Elena Ezhova | 2045669 | 2017-07-10 14:30:27 +0400 | [diff] [blame] | 331 | return neutron_interface.create_port({'port': port_params}) |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 332 | |
| 333 | |
| 334 | @_autheticate |
| 335 | def update_port(neutron_interface, port_id, **port_params): |
| 336 | ''' |
| 337 | Create a new port in OpenStack |
| 338 | CLI Example: |
| 339 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 340 | salt '*' neutronng.update_port name='new_port_name' |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 341 | ''' |
| 342 | neutron_interface.update_port(port_id, {'port': port_params}) |
| 343 | |
| 344 | |
| 345 | @_autheticate |
| 346 | def delete_floatingip(neutron_interface, floating_ip_id): |
| 347 | ''' |
| 348 | delete a floating IP |
| 349 | CLI Example: |
| 350 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 351 | salt '*' neutronng.delete_floatingip openstack-floating-ip-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 352 | ''' |
| 353 | neutron_interface.delete_floatingip(floating_ip_id) |
| 354 | |
| 355 | |
| 356 | @_autheticate |
| 357 | def delete_security_group(neutron_interface, sg_id): |
| 358 | ''' |
| 359 | delete a security group |
| 360 | CLI Example: |
| 361 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 362 | salt '*' neutronng.delete_security_group openstack-security-group-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 363 | ''' |
| 364 | neutron_interface.delete_security_group(sg_id) |
| 365 | |
| 366 | |
| 367 | @_autheticate |
| 368 | def delete_security_group_rule(neutron_interface, rule): |
| 369 | ''' |
| 370 | delete a security group rule. pass all rule params that match the rule |
| 371 | to be deleted |
| 372 | CLI Example: |
| 373 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 374 | salt '*' neutronng.delete_security_group_rule direction='ingress' |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 375 | ethertype='ipv4' security_group_id='openstack-security-group-id' |
| 376 | port_range_min=100 port_range_max=4096 protocol='tcp' |
| 377 | remote_group_id='default' |
| 378 | ''' |
| 379 | sg_rules = neutron_interface.list_security_group_rules( |
| 380 | security_group_id=rule['security_group_id']) |
| 381 | for sg_rule in sg_rules['security_group_rules']: |
| 382 | sgr_id = sg_rule.pop('id') |
| 383 | if sg_rule == rule: |
| 384 | neutron_interface.delete_security_group_rule(sgr_id) |
| 385 | |
| 386 | |
| 387 | @_autheticate |
| 388 | def delete_subnet(neutron_interface, subnet_id): |
| 389 | ''' |
| 390 | delete given subnet |
| 391 | CLI Example: |
| 392 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 393 | salt '*' neutronng.delete_subnet openstack-subnet-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 394 | ''' |
| 395 | neutron_interface.delete_subnet(subnet_id) |
| 396 | |
| 397 | |
| 398 | @_autheticate |
| 399 | def delete_network(neutron_interface, network_id): |
| 400 | ''' |
| 401 | delete given network |
| 402 | CLI Example: |
| 403 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 404 | salt '*' neutronng.delete_network openstack-network-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 405 | ''' |
| 406 | neutron_interface.delete_network(network_id) |
| 407 | |
| 408 | |
| 409 | @_autheticate |
| 410 | def delete_router(neutron_interface, router_id): |
| 411 | ''' |
| 412 | delete given router |
| 413 | CLI Example: |
| 414 | .. code-block:: bash |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 415 | salt '*' neutronng.delete_router openstack-router-id |
Jiri Broulik | f1b3aa4 | 2017-01-26 17:08:44 +0100 | [diff] [blame] | 416 | ''' |
Your Name | 96fdc0a | 2017-05-05 12:56:28 +0000 | [diff] [blame] | 417 | neutron_interface.delete_router(router_id) |
| 418 | |