Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tox test to validate parser #100

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ansible
4 changes: 2 additions & 2 deletions tests/parser_templates/cli/show_interfaces/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
- interfaces['GigabitEthernet0/0/1']['admin-status'] == 'enabled'
- interfaces['Tunnel0']['admin-status'] == 'enabled'
- interfaces['Tunnel0']['oper-status'] == 'down'
- interfaces['GigabitEthernet0']['counters']['in-broadcast-pkts'] == 4891144
- interfaces['GigabitEthernet0']['counters']['in-broadcast-pkts'] == '4891144'
- interfaces['GigabitEthernet0']['counters']['in-multicast-pkts'] == None
- interfaces['Virtual-Access1']['mtu'] == 1500
- interfaces['Virtual-Access1']['mtu'] == '1500'
- interfaces['Tunnel2']['description'] == 'tunnel for gloabl routing for SJC'
- interfaces['GigabitEthernet0/0/5']['type'] == '6XGE-BUILT-IN'
- interfaces['Tunnel0']['type'] == 'Tunnel'
Expand Down
2 changes: 2 additions & 0 deletions tests/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
- import_playbook: test_parser_templates.yaml
20 changes: 20 additions & 0 deletions tools/test-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -ex
# Copyright 2017 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE(pabelanger): Create a symlink for ansible-network.network-engine to keep
# meta/main.yml happy
ln -s ~/src/github.com/ansible-network/network-engine \
~/src/github.com/ansible-network/ansible-network.network-engine
8 changes: 7 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ envlist = linters

[testenv]
install_command = pip install {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
commands =
ansible-playbook -v -i tests/inventory tests/test.yaml
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
setenv =
ANSIBLE_CALLBACK_PLUGINS = {envsitepackagesdir}/ara/plugins/callbacks

[testenv:linters]
basepython = python3
Expand Down