Skip to content

Commit

Permalink
Merge pull request #1186 from GRIDAPPSD/releases/2019.12.0
Browse files Browse the repository at this point in the history
Release of version 2019.12.0
  • Loading branch information
poorva1209 authored Jan 7, 2020
2 parents 7cadef8 + f4a3d6d commit cc2df83
Show file tree
Hide file tree
Showing 67 changed files with 863 additions and 289 deletions.
7 changes: 5 additions & 2 deletions .travis/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ setup_dependencies() {
sudo apt install realpath python python-pip -y
sudo apt install --only-upgrade docker-ce -y

sudo pip install docker-compose || true

docker info

sudo rm /usr/local/bin/docker-compose
curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
docker-compose --version
}

Expand Down
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ ARG TIMESTAMP

# Get the gridappsd-python from the proper repository
RUN cd ${TEMP_DIR} \
&& git clone https://github.com/GRIDAPPSD/gridappsd-python -b master \
&& git clone https://github.com/GRIDAPPSD/gridappsd-python -b develop \
&& cd gridappsd-python \
&& pip3 install . \
&& rm -rf /root/.cache/pip/wheels

# Get the gridappsd-sensor-simulator from the proper repository
RUN cd ${TEMP_DIR} \
&& git clone https://github.com/GRIDAPPSD/gridappsd-sensor-simulator -b master \
&& git clone https://github.com/GRIDAPPSD/gridappsd-sensor-simulator -b develop \
&& cd gridappsd-sensor-simulator \
&& pip3 install -r requirements.txt \
&& mkdir -p /gridappsd/services/gridappsd-sensor-simulator \
Expand All @@ -21,7 +21,7 @@ RUN cd ${TEMP_DIR} \
&& cp /gridappsd/services/gridappsd-sensor-simulator/sensor_simulator.config /gridappsd/services/ \
&& rm -rf /root/.cache/pip/wheels

# Get the gridappsd-sensor-simulator from the proper repository
# Get the gridappsd-voltage-violation from the proper repository
RUN cd ${TEMP_DIR} \
&& git clone https://github.com/GRIDAPPSD/gridappsd-voltage-violation -b develop \
&& cd gridappsd-voltage-violation \
Expand All @@ -30,6 +30,15 @@ RUN cd ${TEMP_DIR} \
&& cp -r * /gridappsd/services/gridappsd-voltage-violation \
&& cp /gridappsd/services/gridappsd-voltage-violation/voltage-violation.config /gridappsd/services/

# Get the gridappsd-dnp3 from the proper repository
RUN cd ${TEMP_DIR} \
&& git clone https://github.com/GRIDAPPSD/gridappsd-dnp3 -b develop \
&& cd gridappsd-dnp3 \
&& mkdir -p /gridappsd/services/gridappsd-dnp3 \
&& rm .git -rf \
&& cp -r dnp3/* /gridappsd/services/gridappsd-dnp3 \
&& cp /gridappsd/services/gridappsd-dnp3/dnp3.config /gridappsd/services/

# Get the gridappsd-alarms from the proper repository
RUN cd ${TEMP_DIR} \
&& git clone https://github.com/GRIDAPPSD/gridappsd-alarms -b develop \
Expand All @@ -39,7 +48,6 @@ RUN cd ${TEMP_DIR} \
&& cp -r * /gridappsd/services/gridappsd-alarms \
&& cp /gridappsd/services/gridappsd-alarms/gridappsd-alarms.config /gridappsd/services/


# Copy initial applications and services into the container.
#
# NOTE: developers should mount a volume over the top of these or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testConnect(){

//Step1: Create GOSS Client
Credentials credentials = new UsernamePasswordCredentials(
GridAppsDConstants.username, GridAppsDConstants.password);
TestConstants.username, TestConstants.password);
client = clientFactory.create(PROTOCOL.STOMP, credentials);

//Create Request Simulation object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ Client getClient() throws Exception{

//Step1: Create GOSS Client
Credentials credentials = new UsernamePasswordCredentials(
GridAppsDConstants.username, GridAppsDConstants.password);
TestConstants.username, TestConstants.password);
// client = clientFactory.create(PROTOCOL.OPENWIRE, credentials);
client = clientFactory.create(PROTOCOL.STOMP, credentials);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ Client getClient() throws Exception{

//Step1: Create GOSS Client
Credentials credentials = new UsernamePasswordCredentials(
GridAppsDConstants.username, GridAppsDConstants.password);
TestConstants.username, TestConstants.password);
// client = clientFactory.create(PROTOCOL.OPENWIRE, credentials);
client = clientFactory.create(PROTOCOL.STOMP, credentials);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,7 @@ public class TestConstants {

public static final String FNCS_BRIDGE_RESPONSE = "{\"command\":\"isInitialized\",\"response\":\"true\",\"output\":\"Any messages from simulator regarding initialization\"}";

public static final String username = "system";
public static final String password = "password";

}
12 changes: 6 additions & 6 deletions gov.pnnl.goss.gridappsd/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
org.apache.felix.dependencymanager.runtime,\
biz.aQute.bnd.annotation,\
pnnl.goss.core.core-api;version=latest,\
pnnl.goss.core.goss-core-security,\
pnnl.goss.core.goss-core-server-api,\
pnnl.goss.core.goss-core-security;version=latest,\
pnnl.goss.core.goss-core-server-api;version=latest,\
pnnl.goss.core.goss-client;version=latest,\
pnnl.goss.core.goss-core-server,\
pnnl.goss.core.goss-core-server-web,\
pnnl.goss.core.goss-core-server-registry,\
pnnl.goss.core.goss-core-server;version=latest,\
pnnl.goss.core.goss-core-server-web;version=latest,\
pnnl.goss.core.goss-core-server-registry;version=latest,\
com.springsource.javax.jms,\
slf4j.api,\
org.apache.activemq.activemq-osgi,\
Expand All @@ -29,7 +29,7 @@
osgi.enroute.base.api,\
org.mockito.mockito-all,\
httpcore,\
blazegraph.cim2glm;version=12.0.0,\
blazegraph.cim2glm;version=18.0.0,\
httpclient,\
com.bigdata.rdf,\
proven-client;version=0.2.3,\
Expand Down
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/conf/org.ops4j.pax.logging.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ log4j.appender.file.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %
#%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout.ConversionPattern=%t %p [%c] - %m%n
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %t %p [%c] - %m%n
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.threshold=INFO

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
user1=123,queue:*,topic:ActiveMQ.Advisory.*,temp-queue:*,fusion:*:read,fusion:CapacityRequirement:write,fusion:InterfacesViolation:write,fusion:VoltageStabilityViolation:write
user2=123,queue:*,topic:ActiveMQ.Advisory.*,temp-queue:*,fusion:*:read,fusion:GeneratorData:write
user3=123,queue:*,topic:ActiveMQ.Advisory.*,temp-queue:*,fusion:*:read
tony=tony,queue:*,topic:ActiveMQ.Advisory.*,temp-queue:*,fusion:*:read,fusion:CapacityRequirement:write,fusion:InterfacesViolation:write,fusion:VoltageStabilityViolation:write
pavel=pavel,queue:*,topic:ActiveMQ.Advisory.*,topic:/goss/fusion/*,temp-queue:*,fusion:*:read,fusion:*:write
erin=erin,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
yousu=yousu,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
poorva=123,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,topic:synthdata/request/*,topic:synthdata/poorva/*,fusion:*:read
admin=admin12345,queue:*,topic:*,temp-queue:*
system=manager,queue:*,topic:*,temp-queue:*,fusion:*:read,fusion:*:write
user1=user1,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user2=user2,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user3=user3,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user4=user4,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user5=user5,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user6=user6,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user7=user7,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user8=user8,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user9=user9,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user10=user10,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user11=user11,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user12=user12,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user13=user13,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user14=user14,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
user15=user15,queue:*,topic:ActiveMQ.Advisory.*,topic:goss/fusion/*,temp-queue:*,fusion:*:read
fncs=fncs,queue:*,topic:*,temp-queue:*,fusion:*:read,fusion:*:write
operator1=operator,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
operator2=operator,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
operator3=operator,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
evaluator1=evaluator,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
evaluator2=evaluator,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
testmanager1=testmanager,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
testmanager2=testmanager,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
application1=application,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
application2=application,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
service1=service,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read
service2=service,queue:*,topic:ActiveMQ.Advisory.*,topic:goss.gridappsd.process.request.status.*,topic:goss.gridappsd.simulation.*,temp-queue:*,fusion:*:read






4 changes: 0 additions & 4 deletions gov.pnnl.goss.gridappsd/conf/pnnl.goss.core.server.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# compilation 'mvn compile' the place holders @@ will be
# replaced with values from a global goss.properties file.

# This user is equivelant to root. Must have '*'
# permissions on the message bus.
goss.system.manager = system
goss.system.manager.password = manager

# The following are used for the core-client connection.
goss.openwire.uri = tcp://0.0.0.0:61616
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
system=admin,operator,evaluator,testmanager,application,service
operator1=operator
operator2=operator
operator3=operator
evaluator1=evaluator,operator
evaluator2=evaluator,operator
testmanager1=testmanager
testmanager2=testmanager
application1=application
application2=application
service1=service
service2=service
17 changes: 17 additions & 0 deletions gov.pnnl.goss.gridappsd/conf/pnnl.goss.security.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Configuration for the goss-core module. Each jar in
# goss-core can be configured using the following. During
# compilation 'mvn compile' the place holders @@ will be
# replaced with values from a global goss.properties file.

# This user is equivelant to root. Must have '*'
# permissions on the message bus.
goss.system.manager = system
goss.system.manager.password = manager

# Used in the core-ssl.bndrun file
client.keystore = ${client.keystore}
client.keystore.password = ${client.keystore.password}
client.truststore = ${client.truststore}
client.truststore.password = ${client.truststore.password}
ssl.enabled = false

1 change: 1 addition & 0 deletions gov.pnnl.goss.gridappsd/gridappsd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Bundle-Version: 0.0.1.${tstamp}

Private-Package: \
gov.pnnl.goss.gridappsd.configuration,\
gov.pnnl.goss.gridappsd.role,\
gov.pnnl.goss.gridappsd.data.conversion,\
gov.pnnl.goss.gridappsd.data.handlers,\
gov.pnnl.goss.gridappsd.data,\
Expand Down
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/run.bnd.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
httpcore,\
httpclient,\
xml-apis,\
blazegraph.cim2glm;version=12.0.0,\
blazegraph.cim2glm;version=18.0.0,\
org.eclipse.jetty.aggregate.jetty-all-server;version=7.6.9,\
javax.servlet-api,\
com.bigdata.rdf,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public interface LogManager {
* @param topic
* Message should be published on this topic if topic is not null.
*/
void log(LogMessage message, String topic);
// void log(LogMessage message, String topic);

/**
* Implementation of this method should call an implementation of
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright (c) 2017, Battelle Memorial Institute All rights reserved.
* Battelle Memorial Institute (hereinafter Battelle) hereby grants permission to any person or entity
* lawfully obtaining a copy of this software and associated documentation files (hereinafter the
* Software) to redistribute and use the Software in source and binary forms, with or without modification.
* Such person or entity may use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and may permit others to do so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
* Other than as used herein, neither the name Battelle Memorial Institute or Battelle may be used in any
* form whatsoever without the express written consent of Battelle.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* BATTELLE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* General disclaimer for use with OSS licenses
*
* This material was prepared as an account of work sponsored by an agency of the United States Government.
* Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any
* of their employees, nor any jurisdiction or organization that has cooperated in the development of these
* materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for
* the accuracy, completeness, or usefulness or any information, apparatus, product, software, or process
* disclosed, or represents that its use would not infringe privately owned rights.
*
* Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer,
* or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United
* States Government or any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed
* herein do not necessarily state or reflect those of the United States Government or any agency thereof.
*
* PACIFIC NORTHWEST NATIONAL LABORATORY operated by BATTELLE for the
* UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830
******************************************************************************/
package gov.pnnl.goss.gridappsd.api;

import java.util.List;


public interface RoleManager {

List<String> getRoles(String userName) throws Exception;

boolean hasRole(String userName, String roleName) throws Exception;

//TODO
//addRole(user, role)
//removeRole(user, role)
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public interface ServiceManager {
* Start service instance
* @param service_id Registered ID of the desired service
* @param runtimeOptions Runtime options for the service instance, in most cases these will be passed in on the command-line
* @return String containing service instance ID
* @return String containing service instance ID or null if service is already started for that simulation
*/
String startService(String service_id, HashMap<String, Object> runtimeOptions); //may also need input/output topics or simulation id

Expand All @@ -111,9 +111,10 @@ public interface ServiceManager {
/**
* Lists currently running service instances for the requested service ID
* @param serviceId Registered ID of the service to list
* @param simulationId Id of the simulation
* @return List of ServiceInstance objects
*/
List<ServiceInstance> listRunningServices(String serviceId);
List<ServiceInstance> listRunningServices(String serviceId, String simulationId);

/**
* Stops service instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import org.apache.http.auth.Credentials;
import org.apache.http.auth.UsernamePasswordCredentials;


import com.google.gson.JsonSyntaxException;

import gov.pnnl.goss.gridappsd.api.AppManager;
Expand All @@ -96,6 +97,7 @@
import pnnl.goss.core.ClientFactory;
import pnnl.goss.core.DataError;
import pnnl.goss.core.DataResponse;
import pnnl.goss.core.security.SecurityConfig;

/**
* This class implements subset of functionalities for Internal Functions 405
Expand All @@ -119,6 +121,9 @@ public class AppManagerImpl implements AppManager {

@ServiceDependency
private volatile LogManager logManager;

@ServiceDependency
private volatile SecurityConfig securityConfig;

private Dictionary<String, ?> configurationProperties;

Expand Down Expand Up @@ -146,12 +151,14 @@ public AppManagerImpl(LogManager logManager,
public void process(int processId, DataResponse event, Serializable message)
throws Exception {

// TODO:Get username from message's metadata e.g. event.getUserName()
username = GridAppsDConstants.username;
// Get username from message's metadata e.g. event.getUserName()
username = event.getUsername();

if (client == null) {


if (client == null) {
Credentials credentials = new UsernamePasswordCredentials(
GridAppsDConstants.username, GridAppsDConstants.password);
securityConfig.getManagerUser(), securityConfig.getManagerPassword());
client = clientFactory.create(PROTOCOL.STOMP, credentials);
}
Destination replyDestination = event.getReplyDestination();
Expand Down Expand Up @@ -258,7 +265,7 @@ public void start(){
"Starting "+this.getClass().getName(),
LogLevel.INFO,
ProcessStatus.RUNNING,
true),GridAppsDConstants.username,
true),securityConfig.getManagerUser(),
GridAppsDConstants.topic_platformLog);

scanForApps();
Expand All @@ -269,7 +276,7 @@ public void start(){
String.format("Found %s applications", apps.size()),
LogLevel.INFO,
ProcessStatus.RUNNING,
true),GridAppsDConstants.username);
true),securityConfig.getManagerUser(),GridAppsDConstants.topic_platformLog);
}catch(Exception e){
e.printStackTrace();
}
Expand Down Expand Up @@ -548,6 +555,7 @@ else if (AppType.PYTHON.equals(appInfo.getType())) {
simulationId, new Date().getTime(),
"Starting app with command "+ String.join(" ",commands),
LogLevel.INFO, ProcessStatus.RUNNING, true),
securityConfig.getManagerUser(),
GridAppsDConstants.topic_simulationLog+simulationId);
try {
process = processAppBuilder.start();
Expand Down
Loading

0 comments on commit cc2df83

Please sign in to comment.