diff options
author | Harry Huang <huangxiangyu5@huawei.com> | 2018-12-04 11:41:34 +0800 |
---|---|---|
committer | Harry Huang <huangxiangyu5@huawei.com> | 2019-02-01 17:24:50 +0800 |
commit | e29a4ea1b77bdb9e78e2fabac8a3029c4c2b61fc (patch) | |
tree | 9279936c6157e4877a6f9630ef6918ef248beaef /util | |
parent | 5999d29ded67ee2847e58fa559dd9da29e1bd150 (diff) |
Adapt compass4nfv scripts to new compass-deck
JIRA: COMPASS-612
1. pass machine info through file
2. generate mac address in config_parse.py
Change-Id: Iaaf0f2b1f4ab97e8200c8c046746168d991570e3
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/check_valid.py | 14 | ||||
-rwxr-xr-x | util/docker-compose/roles/machines/tasks/main.yml | 14 |
2 files changed, 8 insertions, 20 deletions
diff --git a/util/check_valid.py b/util/check_valid.py index e6a72e71..9348d272 100644 --- a/util/check_valid.py +++ b/util/check_valid.py @@ -98,25 +98,19 @@ def check_dha_file(dha): invalid = False if dha['TYPE'] == 'baremetal': for i in dha['hosts']: - if not is_valid_mac(i['mac']): - err_print('''invalid address: - hosts: - - name: %s - mac: %s''' % (i['name'], i['mac'])) - invalid = True for j in i['interfaces']: - if not is_valid_mac(j.values()[0]): + if not is_valid_mac(i['interfaces'].get(j)): err_print('''invalid address: hosts: - name: %s interfaces: - - %s: %s''' % (i['name'], j.keys()[0], j.values()[0])) # noqa: E501 + - %s: %s''' % (i['name'], j, i['interfaces'].get(j))) # noqa: E501 invalid = True - if not is_valid_ip(i['ipmiIp']): + if not is_valid_ip(i['power_ip']): err_print('''invalid address: hosts: - name: %s - ipmiIp: %s''' % (i['name'], i['ipmiIp'])) + power_ip: %s''' % (i['name'], i['power_ip'])) invalid = True if not invalid: diff --git a/util/docker-compose/roles/machines/tasks/main.yml b/util/docker-compose/roles/machines/tasks/main.yml index 365a9d90..7b4a9f18 100755 --- a/util/docker-compose/roles/machines/tasks/main.yml +++ b/util/docker-compose/roles/machines/tasks/main.yml @@ -1,21 +1,15 @@ --- -- name: create switch file if test mode enabled - template: src=switch_machines_file.j2 - dest="{{ docker_compose_dir }}/switch_machines_file" - tags: - - redploy - - name: docker cp switch_machines_file shell: | - docker cp "{{ docker_compose_dir }}/switch_machines_file" \ - compass-deck:/tmp/switch_machines_file + docker cp "{{ docker_compose_dir }}/machine" \ + compass-deck:/tmp/machine tags: - redploy - name: inject switches and mac addresses shell: | docker exec compass-deck bash -c \ - "/opt/compass/bin/manage_db.py set_switch_machines \ - --switch_machines_file /tmp/switch_machines_file" + "/opt/compass/bin/manage_db.py set_machine \ + --machine_file /tmp/machine" tags: - redploy |