summaryrefslogtreecommitdiffstats
path: root/deploy/post/neutron.py
blob: 0dffdfc30b4b5e1d96c7d30a0061b57f1be217dc (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
##############################################################################
# Copyright (c) 2017 ZTE Coreporation and others.
# feng.xiaowei@zte.com.cn
# 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
##############################################################################
from neutronclient.neutron import client as neutronclient

import keystoneauth


class Neutron(object):
    def __init__(self, api_v='2', openrc=None):
        session = keystoneauth.Keystoneauth(openrc).session
        self.client = neutronclient.Client(api_v, session=session)

    def list_networks(self):
        networks = self.client.list_networks()['networks']
        for network in networks:
            print network

    def create_admin_ext_net(self):
        pass