-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1318 from GlobalNOC/2.0.12-dev
2.0.12
- Loading branch information
Showing
102 changed files
with
7,910 additions
and
1,336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
MYSQL_PASSWORD= | ||
OESS_PASSWORD= | ||
OESS_NETWORK_TYPE=vpn-mpls | ||
NSO_HOST= | ||
NSO_PASSWORD= | ||
NSO_USERNAME= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM centos:7 | ||
|
||
COPY globalnoc-public-el7.repo /etc/yum.repos.d/globalnoc-public-el7.repo | ||
RUN curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | bash | ||
RUN curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | bash | ||
|
||
RUN yum makecache | ||
RUN yum -y install epel-release | ||
RUN yum -y install perl httpd mariadb-server rabbitmq-server | ||
RUN yum -y install perl-Carp-Always perl-Test-Deep perl-Test-Exception perl-Test-Pod perl-Test-Pod-Coverage perl-Devel-Cover perl-Net-AMQP-RabbitMQ perl-LWP-Protocol-https perl-AnyEvent-HTTP | ||
RUN yum -y install perl-OESS oess-core oess-frontend yui2 | ||
|
||
COPY app/mpls/mpls_discovery.pl /usr/bin/mpls_discovery.pl | ||
COPY app/mpls/mpls_fwdctl.pl /usr/bin/mpls_fwdctl.pl | ||
|
||
COPY frontend/conf/oe-ss.conf.example /etc/httpd/conf.d/oe-ss.conf | ||
COPY app/etc/firmware.xml /etc/oess/firmware.xml | ||
COPY perl-lib/OESS/t/conf/database.xml /etc/oess/database.xml | ||
COPY perl-lib/OESS/t/conf/logging.conf /etc/oess/logging.conf | ||
COPY perl-lib/OESS/t/conf/passwd.xml /etc/oess/.passwd.xml | ||
|
||
COPY perl-lib/OESS/entrypoint.dev.sh /entrypoint.sh | ||
RUN chmod 777 /entrypoint.sh | ||
|
||
RUN touch /var/log/oess.log | ||
RUN chmod 666 /var/log/oess.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
OESS_VERSION=2.0.11 | ||
OESS_NETWORK=oess | ||
|
||
container: | ||
docker build -f Dockerfile.dev --tag oess:${OESS_VERSION} . | ||
dev: | ||
docker run -it \ | ||
--env-file .env \ | ||
--publish 8000:80 \ | ||
--publish 5672:5672 \ | ||
--network ${OESS_NETWORK} \ | ||
--mount type=bind,src=${PWD}/perl-lib/OESS/lib/OESS,dst=/usr/share/perl5/vendor_perl/OESS \ | ||
--mount type=bind,src=${PWD}/frontend,dst=/usr/share/oess-frontend \ | ||
--mount type=bind,src=${PWD}/perl-lib/OESS/share,dst=/usr/share/doc/perl-OESS-${OESS_VERSION}/share \ | ||
oess:${OESS_VERSION} /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
NAME= oess-core | ||
VERSION = 2.0.11 | ||
VERSION = 2.0.12 | ||
|
||
rpm: dist | ||
rpmbuild -ta dist/$(NAME)-$(VERSION).tar.gz | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use AnyEvent; | ||
use English; | ||
use Getopt::Long; | ||
use Proc::Daemon; | ||
|
||
use OESS::Config; | ||
use OESS::NSO::Discovery; | ||
|
||
my $pid_file = "/var/run/oess/nso_discovery.pid"; | ||
my $cnf_file = "/etc/oess/database.xml"; | ||
|
||
sub core{ | ||
Log::Log4perl::init_and_watch('/etc/oess/logging.conf', 10); | ||
|
||
my $config = new OESS::Config(config_filename => $cnf_file); | ||
if ($config->network_type eq 'nso') { | ||
my $discovery = new OESS::NSO::Discovery(config_obj => $config); | ||
$discovery->start; | ||
AnyEvent->condvar->recv; | ||
} else { | ||
die "Unexpected network type configured."; | ||
} | ||
|
||
Log::Log4perl->get_logger('OESS.NSO.Discovery.APP')->info("Starting OESS.NSO.Discovery event loop."); | ||
} | ||
|
||
sub main{ | ||
my $is_daemon = 0; | ||
my $verbose; | ||
my $username; | ||
#remove the ready file | ||
|
||
#--- see if the pid file exists. if not then just continue running. | ||
if(-e $pid_file){ | ||
#--- read the file to get the PID | ||
my $pid = `head -n 1 $pid_file`; | ||
chomp $pid; | ||
|
||
my $run_test = `ps -p $pid | grep $pid`; | ||
|
||
#--- if run test is empty then the pid didn't exist. If it isn't empty then the process is already running. | ||
if($run_test){ | ||
print "Found $0 process: $pid already running. Aborting.\n"; | ||
exit(0); | ||
} | ||
else{ | ||
print "Pid File: $pid_file already exists but it looks like process $pid is dead. Continuing startup.\n"; | ||
} | ||
} | ||
|
||
my $result = GetOptions ( | ||
"user|u=s" => \$username, | ||
"verbose" => \$verbose, | ||
"daemon|d" => \$is_daemon, | ||
); | ||
|
||
#now change username/ | ||
if (defined $username) { | ||
my $new_uid=getpwnam($username); | ||
my $new_gid=getgrnam($username); | ||
$EGID=$new_gid; | ||
$EUID=$new_uid; | ||
} | ||
|
||
if ($is_daemon != 0) { | ||
my $daemon; | ||
if ($verbose) { | ||
$daemon = Proc::Daemon->new( | ||
pid_file => $pid_file, | ||
child_STDOUT => '/var/log/oess/nso_discovery.out', | ||
child_STDERR => '/var/log/oess/nso_discovery.log', | ||
); | ||
} else { | ||
$daemon = Proc::Daemon->new(pid_file => $pid_file); | ||
} | ||
|
||
# Init returns the PID (scalar) of the daemon to the parent, or | ||
# the PIDs (array) of the daemons created if exec_command has | ||
# more then one program to execute. | ||
# | ||
# Init returns 0 to the child (daemon). | ||
my $kid_pid = $daemon->Init; | ||
if ($kid_pid) { | ||
`chmod 0644 $pid_file`; # How to wait until the child process is ready. | ||
return; | ||
} else { | ||
core(); | ||
} | ||
} | ||
#not a daemon, just run the core; | ||
else { | ||
$SIG{HUP} = sub{ exit(0); }; | ||
core(); | ||
} | ||
} | ||
|
||
main(); | ||
|
||
1; |
Oops, something went wrong.