Skip to content
Open
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
23 changes: 10 additions & 13 deletions devstack/lib/nfp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function namespace_create {
else
echo "New Neutron Port Created on Service management network with ip =$new_ip"
fi
new_ip_cidr+="$new_ip/24"
new_ip_cidr="$new_ip/24"
sleep 2

#get the ip address of new port eg : 11.0.0.6 and asign to namespace
Expand Down Expand Up @@ -410,19 +410,16 @@ function namespace_create {
echo "Fails reaching to $configurator_ip"
fi

sudo ip netns exec nfp-proxy /usr/bin/nfp_proxy --config-file=/etc/nfp_proxy.ini
sudo ip netns exec nfp-proxy /usr/bin/nfp_proxy --config-file=/etc/nfp.ini
}

# copy_nfp_files_and_start_process() - Setup configuration and start processes
function copy_nfp_files_and_start_process {
cd $NFPSERVICE_DIR/gbpservice/nfp
sudo cp -r bin/nfp /usr/bin/
sudo chmod +x /usr/bin/nfp
sudo rm -rf /etc/nfp_*
sudo cp -r bin/nfp_orchestrator.ini /etc/
sudo cp -r bin/nfp_proxy_agent.ini /etc/
[[ $NFP_DEVSTACK_MODE = advanced ]] && sudo cp -r ../contrib/nfp/bin/nfp_config_orch.ini /etc/
sudo cp -r bin/nfp_proxy.ini /etc/nfp_proxy.ini
sudo rm -rf /etc/nfp.ini
sudo cp -r bin/nfp.ini /etc/
sudo cp -r bin/nfp_proxy /usr/bin/

if [[ $NFP_DEVSTACK_MODE = base ]]; then
Expand All @@ -432,19 +429,19 @@ function copy_nfp_files_and_start_process {
configurator_ip=$configurator_ip
configurator_port=8070
fi
echo "Configuring proxy.ini .... with rest_server_address as $configurator_ip:$configurator_port"
sudo sed -i "s/rest_server_address=*.*/rest_server_address=$configurator_ip/g" /etc/nfp_proxy.ini
sudo sed -i "s/rest_server_port= *.*/rest_server_port=$configurator_port/g" /etc/nfp_proxy.ini
echo "Configuring nfp.ini .... with nfp_controller_ip as $configurator_ip:$configurator_port"
sudo sed -i "s/nfp_controller_ip=*.*/nfp_controller_ip=$configurator_ip/g" /etc/nfp.ini
sudo sed -i "s/nfp_controller_port= *.*/nfp_controller_port=$configurator_port/g" /etc/nfp.ini

sed -i 's#source.*#source '$DEVSTACK_DIR'/openrc demo demo#g' $NFPSERVICE_DIR/devstack/exercises/nfp_service/*.sh
source $DEVSTACK_DIR/functions-common

echo "Starting nfp_orchestrator under screen named nfp_orchestrator"
run_process nfp_orchestrator "sudo /usr/bin/nfp --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini --config-file /etc/nfp_orchestrator.ini --log-file $DEST/logs/nfp_orchestrator.log"
run_process nfp_orchestrator "sudo /usr/bin/nfp --module orchestrator --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini --config-file /etc/nfp.ini --log-file $DEST/logs/nfp_orchestrator.log"
sleep 4

echo "Starting nfp_proxy_agent under screen named nfp_proxy_agent"
run_process nfp_proxy_agent "sudo /usr/bin/nfp --config-file /etc/nfp_proxy_agent.ini --log-file $DEST/logs/nfp_proxy_agent.log"
run_process nfp_proxy_agent "sudo /usr/bin/nfp --module proxy_agent --config-file /etc/nfp.ini --log-file $DEST/logs/nfp_proxy_agent.log"
sleep 4

echo "Starting nfp_proxy inside namespace named nfp-proxy, under screen named nfp_proxy"
Expand All @@ -453,7 +450,7 @@ function copy_nfp_files_and_start_process {

if [[ $NFP_DEVSTACK_MODE = advanced ]]; then
echo "Starting nfp_config_orchestrator under screen named nfp_config_orchestrator"
run_process nfp_config_orchestrator "sudo /usr/bin/nfp --config-file /etc/nfp_config_orch.ini --config-file /etc/neutron/neutron.conf --log-file $DEST/logs/nfp_config_orchestrator.log"
run_process nfp_config_orchestrator "sudo /usr/bin/nfp --module config_orchestrator --config-file /etc/nfp.ini --config-file /etc/neutron/neutron.conf --log-file $DEST/logs/nfp_config_orchestrator.log"
else
cd pecan/api
sudo python setup.py develop
Expand Down
2 changes: 1 addition & 1 deletion gbpservice/contrib/nfp/bin/nfp_configurator.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[DEFAULT]
[CONFIGURATOR]
policy_file=/etc/policy.json
debug=False
rabbit_password=guest
Expand Down
44 changes: 44 additions & 0 deletions gbpservice/contrib/nfp/configurator/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from oslo_config import cfg as oslo_config

nfp_configurator_opts = [
oslo_config.StrOpt('policy_file',
default='/etc/policy.json',
help='use credentials file path'),
oslo_config.StrOpt('rabbit_password',
default='guest',
help='RabbitMq server login password'),
oslo_config.StrOpt('rabbit_userid',
default='guest',
help='RabbiMq server User ID'),
oslo_config.StrOpt('rabbit_hosts',
default='127.0.0.1',
help='RabbitMq server IP address for multi node setup'),
oslo_config.IntOpt('rabbit_port',
default=5672,
help='RabbitMq server port number'),
oslo_config.FloatOpt('kombu_reconnect_delay',
default=1.0, help='Kombu reconnection delay'),
oslo_config.StrOpt('rabbit_host',
default='<openstack controller ip address>',
help='RabbitMq server IP address for single node setup'),
oslo_config.StrOpt('control_exchange',
default='openstack',
help='RabbitMq control exchange name'),
oslo_config.BoolOpt('rabbit_use_ssl',
default=False, help='RabbitMq SSL mode True/False'),
oslo_config.StrOpt('rabbit_virtual_host',
default='/', help='RabbitMq virtual host path'),
oslo_config.IntOpt('reportstate_interval',
default=10, help='Report stats interval'),
oslo_config.IntOpt('periodic_interval',
default=2, help='periodic interval'),
oslo_config.StrOpt('log_forward_ip_address',
default='', help='log collector host IP address'),
oslo_config.IntOpt('log_forward_port',
default=514, help='log collector port number'),
oslo_config.StrOpt('log_level',
default='debug', help='log level'),
]

oslo_config.CONF.register_opts(nfp_configurator_opts, "configurator")

2 changes: 1 addition & 1 deletion gbpservice/contrib/nfp/configurator/run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

service rabbitmq-server start
screen -dmS "configurator" /usr/bin/python2 /usr/bin/nfp --config-file=/etc/nfp_configurator.ini --log-file=/var/log/nfp/nfp_configurator.log
screen -dmS "configurator" /usr/bin/python2 /usr/bin/nfp --config-file=/etc/nfp_configurator.ini --module configurator --log-file=/var/log/nfp/nfp_configurator.log
cd /usr/local/lib/python2.7/dist-packages/gbpservice/nfp/pecan/api/
python setup.py develop
screen -dmS "pecan" pecan configurator_decider config.py --mode advanced
Expand Down
58 changes: 58 additions & 0 deletions gbpservice/nfp/bin/nfp.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[ORCHESTRATOR]
# Number of worker process to be spawned.
workers=1
# Path to NFP modules in . format
# NFP core framework will load all .py files
# from this path as nfp modules
nfp_modules_path=gbpservice.nfp.orchestrator.modules
# To invoke OTC Apis
# It could be rpc/REST.
# rpc - where fip access unavaiable for OTC NFP controller
# REST - where fip access is available for OTC NFP controller
backend=rpc

[PROXY_AGENT]
# Number of worker process to be spawned.
workers=1
# Path to NFP modules in . format
# NFP core framework will load all .py files
# from this path as nfp modules
nfp_modules_path=gbpservice.nfp.proxy_agent.modules
# To invoke OTC Apis
# Proxy agent will always use unix_rest backend to
# communicate with proxy component inside namespace
backend=unix_rest

[PROXY]
# Path unix server should bind to
unix_bind_path= /var/run/uds_socket
# Max number of client connections
max_connections=10
# Num of worker threads to handle connections
worker_threads=100
# Timeout for 'connect' operation
connect_max_wait_timeout=120
# Max time an idle channel is allowed to be open
idle_max_wait_timeout=120
# Min time to wait on channel to declare its idle.
idle_min_wait_timeout=0.1
#NFP controllers ip address and port
nfp_controller_ip=172.16.0.3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't hardcode. Leave it empty.

nfp_controller_port=8070

@rajendramachani rajendramachani Aug 9, 2016

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test devstack/lib/nfp change
sudo sed -i "s/nfp_controller_port= ./nfp_controller_port=$configurator_port/g" /etc/nfp.ini

the sed line above has space after = and also has .
Will it work ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this comment. I am convinced with the sed line. It should work.


[CONFIG_ORCHESTRATOR]
# Number of worker process to be spawned.
workers=1
# Path to NFP modules in . format
# NFP core framework will load all .py files
# from this path as nfp modules
nfp_modules_path=gbpservice.contrib.nfp.config_orchestrator.modules
# To invoke OTC Apis
# Proxy agent will always use unix_rest backend to
# communicate with proxy component inside namespace
backend=rpc

# Section describing params for backend=rpc
[RPC]
# Topic to send OTC request rpc on.
topic=nfp-proxy-agent-topic
39 changes: 10 additions & 29 deletions gbpservice/nfp/core/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

from oslo_config import cfg as oslo_config

CONF = oslo_config.CONF

NFP_OPTS = [
oslo_config.IntOpt(
'workers',
Expand All @@ -24,43 +26,22 @@
default='gbpservice.nfp.core.test',
help='Path for NFP modules.'
'All modules from this path are autloaded by framework'
)
]

es_openstack_opts = [
oslo_config.StrOpt('auth_host',
default='localhost',
help='Openstack controller IP Address'),
oslo_config.StrOpt('admin_user',
help='Admin user name to create service VMs'),
oslo_config.StrOpt('admin_password',
help='Admin password to create service VMs'),
oslo_config.StrOpt('admin_tenant_name',
help='Admin tenant name to create service VMs'),
oslo_config.StrOpt('admin_tenant_id',
help='Admin tenant ID to create service VMs'),
oslo_config.StrOpt('auth_protocol',
default='http', help='Auth protocol used.'),
oslo_config.IntOpt('auth_port',
default='5000', help='Auth protocol used.'),
oslo_config.IntOpt('bind_port',
default='9696', help='Auth protocol used.'),
oslo_config.StrOpt('auth_version',
default='v2.0', help='Auth protocol used.'),
oslo_config.StrOpt('auth_uri',
default='', help='Auth URI.'),
),
oslo_config.StrOpt(
'backend',
default='rpc',
help='Backend Support for communicationg with configurator.'
),
]


def init(args, **kwargs):
def init(module, args, **kwargs):
"""Initialize the configuration. """
oslo_config.CONF.register_opts(NFP_OPTS)
oslo_config.CONF.register_opts(es_openstack_opts, "keystone_authtoken")
oslo_config.CONF.register_opts(NFP_OPTS, module)
oslo_config.CONF.set_override('use_syslog', 'True')
oslo_config.CONF.set_override('syslog_log_facility', 'local1')
oslo_config.CONF(args=args, project='nfp',
version='%%(prog)s %s' % ('version'),
#version.version_info.release_string()),
**kwargs)

return oslo_config.CONF
28 changes: 26 additions & 2 deletions gbpservice/nfp/core/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def fork_child(self, wrap):

message = ("Forked a new child: %d"
"Parent Pipe: % s, Child Pipe: % s") % (
proc.pid, str(parent_pipe), str(child_pipe))
proc.pid, str(parent_pipe), str(child_pipe))
LOG.info(message)

try:
Expand Down Expand Up @@ -572,8 +572,32 @@ def nfp_modules_post_init(conf, nfp_modules, nfp_controller):
LOG.debug(message)


def _module(args):
try:
index = args.index('--module')
module = args[index + 1]
return module
except ValueError:
print "--module <name> missing from cmd args"
sys.exit(-1)


def main():
conf = nfp_cfg.init(sys.argv[1:])
args = sys.argv[1:]
module = _module(args)
args = sys.argv[1:]
module = _module(args)
args.remove('--module')
args.remove(module)
conf = nfp_cfg.init(module, args)
conf.module = module
module_opts = eval('conf.%s.keys' % (module))()
for module_opt in module_opts:
module_cfg_opt = eval("conf.%s._group._opts['%s']['opt']" % (
module, module_opt))
module_cfg_opt_value = eval("conf.%s.%s" % (module, module_opt))
conf.register_opt(module_cfg_opt)
conf.set_override(module_opt, module_cfg_opt_value)
nfp_common.init()
nfp_controller = NfpController(conf)
# Load all nfp modules from path configured
Expand Down
9 changes: 0 additions & 9 deletions gbpservice/nfp/lib/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@
default='', help='Topic for rpc connection'),
]

OPTS = [
cfg.StrOpt(
'backend',
default='rpc',
help='Backend Support for communicationg with configurator.'
),
]

oslo_config.CONF.register_opts(OPTS)
oslo_config.CONF.register_opts(rest_opts, "REST")
oslo_config.CONF.register_opts(rpc_opts, "RPC")
n_rpc.init(cfg.CONF)
Expand Down
27 changes: 27 additions & 0 deletions gbpservice/nfp/orchestrator/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from oslo_config import cfg as oslo_config

es_openstack_opts = [
oslo_config.StrOpt('auth_host',
default='localhost',
help='Openstack controller IP Address'),
oslo_config.StrOpt('admin_user',
help='Admin user name to create service VMs'),
oslo_config.StrOpt('admin_password',
help='Admin password to create service VMs'),
oslo_config.StrOpt('admin_tenant_name',
help='Admin tenant name to create service VMs'),
oslo_config.StrOpt('admin_tenant_id',
help='Admin tenant ID to create service VMs'),
oslo_config.StrOpt('auth_protocol',
default='http', help='Auth protocol used.'),
oslo_config.IntOpt('auth_port',
default='5000', help='Auth protocol used.'),
oslo_config.IntOpt('bind_port',
default='9696', help='Auth protocol used.'),
oslo_config.StrOpt('auth_version',
default='v2.0', help='Auth protocol used.'),
oslo_config.StrOpt('auth_uri',
default='', help='Auth URI.'),
]

oslo_config.CONF.register_opts(es_openstack_opts, "keystone_authtoken")
Loading