summaryrefslogtreecommitdiffstats
path: root/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml
AgeCommit message (Expand)AuthorFilesLines
2018-07-11Revert "vPE Sample VNF is missing in the installation scripts"Volodymyr Mytnyk1-2/+0
2018-05-22Fix vCGNAPT name in ansible constantsRodolfo Alonso Hernandez1-1/+1
2018-05-22vPE Sample VNF is missing in the installation scriptsRodolfo Alonso Hernandez1-0/+2
2017-12-14Bugfix:proxy env, ansible multinode supportMalanik Jan1-2/+3
2017-10-11increase number of open files for collectdRoss Brattain1-0/+2
2017-10-09install pmu tools collectd pluginRoss Brattain1-0/+2
2017-10-06Merge "libyajl: install from pkg"Ross Brattain1-2/+0
2017-10-05Fixed compilation of latest samplevnfMaciej Skrocki1-0/+2
2017-10-05libyajl: install from pkgDhaval Patel1-2/+0
2017-09-28add collectd ansibleRoss Brattain1-0/+9
2017-09-05Introduced ansible playbook to setup NSB.Maciej Skrocki1-1/+0
2017-08-23ansible: update dpdk, trex and samplevnf installRoss Brattain1-0/+43
ighlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
##############################################################################
# Copyright (c) 2016 Dan Radez (Red Hat)
#
# 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 ipaddress

from copy import copy

from apex.common.constants import (
    EXTERNAL_NETWORK,
    TENANT_NETWORK,
    STORAGE_NETWORK,
    API_NETWORK,
    CONTROLLER)
from apex.network_settings import NetworkSettings
from apex.network_environment import (
    NetworkEnvironment,
    NetworkEnvException,
    EXTERNAL_RESOURCES,
    TENANT_RESOURCES,
    STORAGE_RESOURCES,
    API_RESOURCES)

from nose.tools import assert_equal
from nose.tools import assert_raises
from nose.tools import assert_is_instance
from nose.tools import assert_not_equal


class TestNetworkEnvironment(object):
    @classmethod
    def setup_class(klass):
        """This method is run once for each class before any tests are run"""
        klass.ns = NetworkSettings(
            '../config/network/network_settings.yaml')
        klass.ns_vlans = NetworkSettings(
            '../config/network/network_settings_vlans.yaml')
        klass.ns_ipv6 = NetworkSettings(
            '../config/network/network_settings_v6.yaml')

    @classmethod
    def teardown_class(klass):
        """This method is run once for each class _after_ all tests are run"""

    def setUp(self):
        """This method is run once before _each_ test method is executed"""

    def teardown(self):
        """This method is run once after _each_ test method is executed"""

    def test_init(self):
        assert_raises(NetworkEnvException, NetworkEnvironment,
                      None, '../build/network-environment.yaml')

    def test_netenv_settings_external_network_vlans(self):
        # test vlans
        ne = NetworkEnvironment(self.ns_vlans,
                                '../build/network-environment.yaml')
        assert_equal(ne['parameter_defaults']['NeutronExternalNetworkBridge'],
                     '""')
        assert_equal(ne['parameter_defaults']['ExternalNetworkVlanID'], 501)

    def test_netenv_settings_external_network_ipv6(self):
        # Test IPv6
        ne = NetworkEnvironment(self.ns_ipv6,
                                '../build/network-environment.yaml')
        regstr = ne['resource_registry']['OS::TripleO::Network::External']
        assert_equal(regstr.split('/')[-1], 'external_v6.yaml')

    def test_netenv_settings_external_network_removed(self):
        ns = copy(self.ns)
        # Test removing EXTERNAL_NETWORK
        ns.enabled_network_list.remove(EXTERNAL_NETWORK)
        ne = NetworkEnvironment(ns, '../build/network-environment.yaml')
        regstr = ne['resource_registry']['OS::TripleO::Network::External']
        assert_equal(regstr.split('/')[-1], 'OS::Heat::None')

    def test_netenv_settings_tenant_network_vlans(self):
        # test vlans
        ne = NetworkEnvironment(self.ns_vlans,
                                '../build/network-environment.yaml')
        assert_equal(ne['parameter_defaults']['TenantNetworkVlanID'], 401)

# Apex is does not support v6 tenant networks
# Though there is code that would fire if a
# v6 cidr was passed in, just uncomment this to
# cover that code
#    def test_netenv_settings_tenant_network_v6(self):
#        # Test IPv6
#        ne = NetworkEnvironment(self.ns_ipv6,
#                                '../build/network-environment.yaml')
#        regstr = ne['resource_registry'][next(iter(TENANT_RESOURCES.keys()))]
#        assert_equal(regstr.split('/')[-1], 'tenant_v6.yaml')

    def test_netenv_settings_tenant_network_removed(self):
        ns = copy(self.ns)
        # Test removing TENANT_NETWORK
        ns.enabled_network_list.remove(TENANT_NETWORK)
        ne = NetworkEnvironment(ns, '../build/network-environment.yaml')
        regstr = ne['resource_registry']['OS::TripleO::Network::Tenant']
        assert_equal(regstr.split('/')[-1], 'OS::Heat::None')

    def test_netenv_settings_storage_network_vlans(self):
        # test vlans
        ne = NetworkEnvironment(self.ns_vlans,
                                '../build/network-environment.yaml')
        assert_equal(ne['parameter_defaults']['StorageNetworkVlanID'], 201)

    def test_netenv_settings_storage_network_v6(self):
        # Test IPv6
        ne = NetworkEnvironment(self.ns_ipv6,
                                '../build/network-environment.yaml')
        regstr = ne['resource_registry']['OS::TripleO::Network::Storage']
        assert_equal(regstr.split('/')[-1], 'storage_v6.yaml')

    def test_netenv_settings_storage_network_removed(self):
        ns = copy(self.ns)
        # Test removing STORAGE_NETWORK
        ns.enabled_network_list.remove(STORAGE_NETWORK)
        ne = NetworkEnvironment(ns, '../build/network-environment.yaml')
        regstr = ne['resource_registry']['OS::TripleO::Network::Storage']
        assert_equal(regstr.split('/')[-1], 'OS::Heat::None')

    def test_netenv_settings_api_network_v4(self):
        ns = copy(self.ns_vlans)
        ns['networks'][API_NETWORK]['enabled'] = True
        ns['networks'][API_NETWORK]['cidr'] = '10.11.12.0/24'
        ns = NetworkSettings(ns)
        # test vlans
        ne = NetworkEnvironment(ns, '../build/network-environment.yaml')
        assert_equal(ne['parameter_defaults']['InternalApiNetworkVlanID'], 101)

    def test_netenv_settings_api_network_vlans(self):
        ns = copy(self.ns_vlans)
        ns['networks'][API_NETWORK]['enabled'] = True
        ns = NetworkSettings(ns)
        # test vlans
        ne = NetworkEnvironment(ns, '../build/network-environment.yaml')
        assert_equal(ne['parameter_defaults']['InternalApiNetworkVlanID'], 101)

    def test_netenv_settings_api_network_v6(self):
        # Test IPv6
        ne = NetworkEnvironment(self.ns_ipv6,
                                '../build/network-environment.yaml')
        regstr = ne['resource_registry']['OS::TripleO::Network::InternalApi']
        assert_equal(regstr.split('/')[-1], 'internal_api_v6.yaml')

    def test_netenv_settings_api_network_removed(self):
        ns = copy(self.ns)
        # API_NETWORK is not in the default network settings file
        ne = NetworkEnvironment(ns, '../build/network-environment.yaml')
        regstr = ne['resource_registry']['OS::TripleO::Network::InternalApi']
        assert_equal(regstr.split('/')[-1], 'OS::Heat::None')

    def test_numa_configs(self):
        ne = NetworkEnvironment(self.ns, '../build/network-environment.yaml',
                                compute_pre_config=True,
                                controller_pre_config=True)
        assert_is_instance(ne, dict)
        assert_not_equal(ne, {})

    def test_exception(self):
        e = NetworkEnvException("test")
        print(e)
        assert_is_instance(e, NetworkEnvException)