summaryrefslogtreecommitdiffstats
path: root/tox.ini
blob: 5aa89972ef9835917dc41a034de333ed084540f1 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[tox]
minversion = 1.6
envlist = py27,pep8, lint
skipsdist = True

[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
setenv =
   VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt
       -r{toxinidir}/test-requirements.txt
commands = py.test -q --basetemp={envtmpdir} {posargs}

[testenv:pep8]
commands = flake8 {toxinidir}

[testenv:lint]
commands = pylint --rcfile pylint.rc nfvbench test

[testenv:venv]
commands = {posargs}

[testenv:cover]
commands = python setup.py testr --coverage --testr-args='{posargs}'

[testenv:docs]
commands = python setup.py build_sphinx

[flake8]
# H803 skipped on purpose per list discussion.
# E123, E125 skipped as they are invalid PEP-8.
max-line-length = 100
show-source = True
#E302: expected 2 blank linee
#E303: too many blank lines (2)
#H233: Python 3.x incompatible use of print operator
#H236: Python 3.x incompatible __metaclass__, use six.add_metaclass()
#H302: import only modules.
#H404: multi line docstring should start without a leading new line
#H405: multi line docstring summary not separated with an empty line
#H904: Wrap long lines in parentheses instead of a backslash
ignore = E123,E125,H803,E302,E303,H104,H233,H236,H302,H404,H405,H904
builtins = _
exclude=venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,dib-venv
9 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
heat_template_version: pike

description: >
  OpenDaylight OVS Configuration.

parameters:
  OpenDaylightPort:
    default: 8081
    description: Set opendaylight service port
    type: number
  OpenDaylightUsername:
    default: 'admin'
    description: The username for the opendaylight server.
    type: string
  OpenDaylightPassword:
    default: 'admin'
    type: string
    description: The password for the opendaylight server.
    hidden: true
  OpenDaylightConnectionProtocol:
    description: L7 protocol used for REST access
    type: string
    default: 'http'
  OpenDaylightCheckURL:
    description: URL postfix to verify ODL has finished starting up
    type: string
    default: 'restconf/operational/network-topology:network-topology/topology/netvirt:1'
  OpenDaylightApiVirtualIP:
    type: string
    default: ''
  OpenDaylightProviderMappings:
    description: Mappings between logical networks and physical interfaces.
                 Required for VLAN deployments.  For example physnet1 -> eth1.
    type: comma_delimited_list
    default: "datacentre:br-ex"
  HostAllowedNetworkTypes:
    description: Allowed tenant network types for this OVS host.  Note this can
                 vary per host or role to constrain which hosts nova instances
                 and networks are scheduled to.
    type: comma_delimited_list
    default: ['local', 'vlan', 'vxlan', 'gre']
  OvsEnableDpdk:
    description: Whether or not to configure enable DPDK in OVS
    default:  false
    type: boolean
  OvsVhostuserMode:
    description: Specify the mode for OVS with vhostuser port creation.  In
                 client mode, the hypervisor will be responsible for creating
                 vhostuser sockets.  In server mode, OVS will create them.
    type: string
    default: "client"
    constraints:
      - allowed_values: [ 'client', 'server' ]
  VhostuserSocketDir:
    description: Specify the directory to use for vhostuser sockets
    type: string
    default: "/var/run/openvswitch"
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    type: json
  ServiceData:
    default: {}
    description: Dictionary packing service data
    type: json
  ServiceNetMap:
    default: {}
    description: Mapping of service_name -> network name. Typically set
                 via parameter_defaults in the resource registry.  This
                 mapping overrides those in ServiceNetMapDefaults.
    type: json
  DefaultPasswords:
    default: {}
    type: json
  RoleName:
    default: ''
    description: Role name on which the service is applied
    type: string
  RoleParameters:
    default: {}
    description: Parameters specific to the role
    type: json

resources:
  Ovs:
    type: ./openvswitch.yaml
    properties:
      ServiceData: {get_param: ServiceData}
      ServiceNetMap: {get_param: ServiceNetMap}
      DefaultPasswords: {get_param: DefaultPasswords}
      EndpointMap: {get_param: EndpointMap}
      RoleName: {get_param: RoleName}
      RoleParameters: {get_param: RoleParameters}

  # Merging role-specific parameters (RoleParameters) with the default parameters.
  # RoleParameters will have the precedence over the default parameters.
  RoleParametersValue:
    type: OS::Heat::Value
    properties:
      type: json
      value:
        map_replace:
          - map_replace:
            - neutron::plugins::ovs::opendaylight::allowed_network_types: HostAllowedNetworkTypes
              neutron::plugins::ovs::opendaylight::enable_dpdk: OvsEnableDpdk
              neutron::plugins::ovs::opendaylight::vhostuser_socket_dir: VhostuserSocketDir
              neutron::plugins::ovs::opendaylight::vhostuser_mode: OvsVhostuserMode
              neutron::plugins::ovs::opendaylight::provider_mappings: OpenDaylightProviderMappings
            - values: {get_param: [RoleParameters]}
          - values:
              HostAllowedNetworkTypes: {get_param: HostAllowedNetworkTypes}
              OvsEnableDpdk: {get_param: OvsEnableDpdk}
              VhostuserSocketDir: {get_param: VhostuserSocketDir}
              OvsVhostuserMode: {get_param: OvsVhostuserMode}
              OpenDaylightProviderMappings: {get_param: OpenDaylightProviderMappings}

outputs:
  role_data:
    description: Role data for the OpenDaylight service.
    value:
      service_name: opendaylight_ovs
      config_settings:
        map_merge:
          - opendaylight::odl_rest_port: {get_param: OpenDaylightPort}
            opendaylight::username: {get_param: OpenDaylightUsername}
            opendaylight::password: {get_param: OpenDaylightPassword}
            neutron::plugins::ovs::opendaylight::odl_username: {get_param: OpenDaylightUsername}
            neutron::plugins::ovs::opendaylight::odl_password: {get_param: OpenDaylightPassword}
            opendaylight_check_url: {get_param: OpenDaylightCheckURL}
            opendaylight::nb_connection_protocol: {get_param: OpenDaylightConnectionProtocol}
            neutron::agents::ml2::ovs::local_ip: {get_param: [ServiceNetMap, NeutronTenantNetwork]}
            tripleo.opendaylight_ovs.firewall_rules:
              '118 neutron vxlan networks':
               proto: 'udp'
               dport: 4789
              '136 neutron gre networks':
               proto: 'gre'
          - get_attr: [Ovs, role_data, config_settings]
          - get_attr: [RoleParametersValue, value]
      step_config: |
        include tripleo::profile::base::neutron::plugins::ovs::opendaylight
      upgrade_tasks:
        list_concat:
          - get_attr: [Ovs, role_data, upgrade_tasks]
          -
            - name: Check if openvswitch is deployed
              command: systemctl is-enabled openvswitch
              tags: common
              ignore_errors: True
              register: openvswitch_enabled
            - name: "PreUpgrade step0,validation: Check service openvswitch is running"
              shell: /usr/bin/systemctl show 'openvswitch' --property ActiveState | grep '\bactive\b'
              when: openvswitch_enabled.rc == 0
              tags: step0,validation
            - name: Stop openvswitch service
              tags: step1
              when: openvswitch_enabled.rc == 0
              service: name=openvswitch state=stopped