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