File: plugin.sh

package info (click to toggle)
networking-l2gw 1%3A13.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,304 kB
  • sloc: python: 12,230; sh: 316; makefile: 31
file content (108 lines) | stat: -rwxr-xr-x 3,016 bytes parent folder | download | duplicates (4)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
# devstack/plugin.sh
# Functions to control the configuration and operation of the l2gw
# Dependencies:
#
# ``functions`` file
# ``DEST`` must be defined
# ``STACK_USER`` must be defined
# ``stack.sh`` calls the entry points in this order:
# Save trace setting

XTRACE=$(set +o | grep xtrace)
set +o xtrace

function install_l2gw {
   setup_develop $L2GW_DIR
   Q_PLUGIN_CONF_PATH=etc/neutron/plugins/ml2
   Q_PLUGIN_CONF_FILENAME=ml2_conf.ini
   Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
}

function configure_agent_conf {
    sudo cp $L2GW_DIR/etc/l2gateway_agent.ini $L2GW_CONF_FILE
    iniset $L2GW_CONF_FILE ovsdb ovsdb_hosts $OVSDB_HOSTS
}

function start_l2gw_agent {
    run_process l2gw-agent "$L2GW_AGENT_BINARY --config-file $NEUTRON_CONF --config-file=$L2GW_CONF_FILE"
}

function run_l2gw_alembic_migration {
   $NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
}

function configure_l2gw_plugin {
    sudo cp $L2GW_DIR/etc/l2gw_plugin.ini $L2GW_PLUGIN_CONF_FILE
    neutron_server_config_add $L2GW_PLUGIN_CONF_FILE
}

function configure_tempest_for_l2gw {
    if is_service_enabled tempest; then
       iniset $TEMPEST_CONFIG l2gw l2gw_switch "cell08-5930-01::FortyGigE1/0/1|100"
       source $TEMPEST_DIR/.tox/tempest/bin/activate
       pip install -r $L2GW_DIR/test-requirements.txt
       deactivate
    fi
}

# main loop
if is_service_enabled l2gw-plugin; then
    if [[ "$1" == "source" ]]; then
        # no-op
        :
    elif [[ "$1" == "stack" && "$2" == "install" ]]; then
        install_l2gw
    elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then
        configure_tempest_for_l2gw
    elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
        neutron_service_plugin_class_add $L2GW_PLUGIN
        configure_l2gw_plugin
        run_l2gw_alembic_migration
        if is_service_enabled neutron-api || is_service_enabled q-svc; then
            echo_summary "Configuring networking-l2gw"
            if [ "$NETWORKING_L2GW_SERVICE_DRIVER" ]; then
                inicomment $L2GW_PLUGIN_CONF_FILE service_providers service_provider
                iniadd $L2GW_PLUGIN_CONF_FILE service_providers service_provider $NETWORKING_L2GW_SERVICE_DRIVER
            fi
        fi
    elif [[ "$1" == "stack" && "$2" == "post-extra" ]]; then
        # no-op
        :
    fi

    if [[ "$1" == "unstack" ]]; then
        # no-op
        :
    fi

    if [[ "$1" == "clean" ]]; then
        # no-op
        :
    fi
fi

if is_service_enabled l2gw-agent; then
    if [[ "$1" == "source" ]]; then
        # no-op
        :
    elif [[ "$1" == "stack" && "$2" == "install" ]]; then
        install_l2gw
    elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
        configure_agent_conf
        start_l2gw_agent
    fi

    if [[ "$1" == "unstack" ]]; then
        #no-op
        :
    fi

    if [[ "$1" == "clean" ]]; then
        #no-op
        :
    fi
fi

# Restore xtrace
$XTRACE