blob: 1b3277e716b8a6a2624d538b513412e8d034eb18 (
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
|
##############################################################################
# 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
##############################################################################
import yaml
from deploy.common import query
class NetworkConfig(object):
def __init__(self, network_file):
self._file = network_file
self._get_config()
def _get_config(self):
self.config = yaml.safe_load(file(self._file))
def _get_network(self, name):
return query.find(lambda item: item['name'] == name,
self.config['networks'])
@property
def external_network(self):
return self._get_network('EXTERNAL')
|