Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
sambabug committed Aug 25, 2018
1 parent 9ed88bf commit 5f3aedc
Show file tree
Hide file tree
Showing 746 changed files with 123,137 additions and 59,953 deletions.
51 changes: 2 additions & 49 deletions TERMS.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,5 @@
Copyright (c) 2013, Battelle Memorial Institute
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. 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.
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.

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 THE COPYRIGHT
OWNER 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.

The views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing
official policies, either expressed or implied, of the FreeBSD
Project.

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
PACIFIC NORTHWEST NATIONAL LABORATORY operated by BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830
38 changes: 28 additions & 10 deletions optional_requirements.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
{
"--platform": {
"help": "Installs requirements for volttron central",
"packages": ["psutil"]
},
"--vc": {
"help": "Installs requirements for volttron central",
"packages": ["tornado>4,<5", "ply"]
},
"--pandas": {
"help": "Installs numpy and pandas for applications",
"packages": ["numpy>1.8,<2", "pandas"]
"packages": ["numpy>1.13,<2", "pandas"]
},
"--testing": {
"help": "Installs testing infrastructure dependencies",
"packages": ["pytest>=2.8,<3", "pytest-bdd>=2.14,<3"]
"packages": ["pytest", "pytest-timeout", "mock", "websocket-client",
"pytest-catchlog"]
},
"--crate": {
"help": "Installs requirements for crate databases",
"packages": ["crate"]
},
"--mysql": {
"help": "Installs requirements for mysql databases",
"packages": ["mysql-connector-python-rf"]
},
"--mongo": {
"help": "Installs requirements for mongo databases",
"packages": ["pymongo"]
},
"--databases": {
"help": "Installs support for all known databases",
"packages": ["pymongo", "mysql-connector-python-rf"]
},
"--documentation": {
"help": "Installs requirements for building the documentation",
"packages": ["sphinx==1.7.2", "mock", "psutil","pymongo",
"mysql-connector-python-rf"]
},
"--market": {
"help": "Installs requirements for the market service",
"packages": ["numpy>1.13,<2", "transitions"]
}
}
19 changes: 15 additions & 4 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[pytest]
addopts = --strict -rsxX -v
timeout = 120
addopts = --strict -rsxX -v --showlocals
# --full-trace

norecursedirs =
services/core/MultiBuilding \
services/deprecated-remove-5.0/MultiBuilding \
.git env scripts volttron.egg-info config

markers =
Expand All @@ -11,6 +13,7 @@ markers =
agent: Testing for core agent operations.
auth: Testing for auth based code.
control: Control service/aip tests.
config_store: Configuration store tests.
dev: Mark for currently developing test.
drivenagent: Tests for driven agent
forwarder: Tests for forwardhistorian
Expand All @@ -20,11 +23,19 @@ markers =
keystore: Test the keystore and known-hosts store.
mongodb: Tests for mongodb related test code.
pa: Tests for the platform agent.
revert: Tests for generic driver revert functionality.
driver: Tests for master driver functionality.
slow: Mark tests that run slowly.
sqlhistorian: Mark for only sql historian tests.
subsystems: Testing subsystems.
web: Tests for web and web services.
wrapper: Test the platformwrapper test code.
vc: Tests associated with volttron central or platform agent
vc: Tests associated with volttron central agent.
vcp: Tests associated with the volttron central platform agent.
zmq: Tests for zmq
aggregator: Run aggregate historian tests
sql_aggregator: Run aggregate historian tests
mongo_aggregator: Run aggregate historian tests
packaging: Run packaging tests
market: Run the market service agent and base market agent tests
tagging: Tagging service tests

3 changes: 3 additions & 0 deletions scripts/admin/volttron
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ DAEMON_ARGS="-v -l $VLHOME/volttron.log"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

#Uncomment and change this to specify a different VOLTTRON_HOME
#export VOLTTRON_HOME=/home/volttron/.volttron

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

Expand Down
19 changes: 19 additions & 0 deletions scripts/admin/volttron.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# VOLTTRON SystemD unit
# Exec Start exectues the volttron platform script built by bootstrap
# This does not have to activate the virtualenv as the script will do that
[Unit]
Description=VOLTTRON Platform Service
After=network.target

[Service]
Type=simple
User=volttron
Group=volttron
WorkingDirectory=/var/lib/volttron
#Uncomment and change this to specify a different VOLTTRON_HOME
#Environment="VOLTTRON_HOME=/home/volttron/.volttron"
ExecStart=/var/lib/volttron/env/bin/volttron -vv
ExecStop=/var/lib/volttron/env/bin/volttron-ctl shutdown --platform

[Install]
WantedBy=multi-user.target
113 changes: 72 additions & 41 deletions scripts/bacnet/bacnet_scan.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

'''
Copyright (c) 2015, Battelle Memorial Institute
Copyright (c) 2016, Battelle Memorial Institute
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -67,14 +67,16 @@
from bacpypes.core import run, stop

from bacpypes.pdu import Address, GlobalBroadcast
from bacpypes.app import LocalDeviceObject, BIPSimpleApplication

from bacpypes.app import BIPSimpleApplication
from bacpypes.service.device import LocalDeviceObject
from bacpypes.apdu import WhoIsRequest, IAmRequest
from bacpypes.basetypes import ServicesSupported
from bacpypes.errors import DecodingError

import threading, time, sys

import csv

# some debugging
_debug = 0
_log = ModuleLogger(globals())
Expand All @@ -88,6 +90,8 @@
# WhoIsIAmApplication
#

this_csv_file = None

@bacpypes_debugging
class WhoIsIAmApplication(BIPSimpleApplication):

Expand Down Expand Up @@ -136,6 +140,13 @@ def indication(self, apdu):
sys.stdout.write('segmentationSupported = ' + str(apdu.segmentationSupported) + '\n')
sys.stdout.write('vendorID = ' + str(apdu.vendorID) + '\n')
sys.stdout.flush()
if this_csv_file is not None:
row = {"address":apdu.pduSource,
"device_id": device_instance,
"max_apdu_length": apdu.maxAPDULengthAccepted,
"segmentation_supported": apdu.segmentationSupported,
"vendor_id": apdu.vendorID}
this_csv_file.writerow(row)

# forward it along
BIPSimpleApplication.indication(self, apdu)
Expand Down Expand Up @@ -176,57 +187,75 @@ def do_whois(self, args):
# __main__
#

try:
# parse the command line arguments
arg_parser = ConfigArgumentParser(description=__doc__)

arg_parser.add_argument("--address",
help="Target only device(s) at <address> for request" )
# parse the command line arguments
arg_parser = ConfigArgumentParser(description=__doc__)

arg_parser.add_argument("--address",
help="Target only device(s) at <address> for request" )

arg_parser.add_argument("--range", type=int, nargs=2, metavar=('LOW', 'HIGH'),
help="Lower and upper limit on device ID in results" )

arg_parser.add_argument("--range", type=int, nargs=2, metavar=('LOW', 'HIGH'),
help="Lower and upper limit on device ID in results" )
arg_parser.add_argument("--timeout", type=int, metavar=('SECONDS'),
help="Time, in seconds, to wait for responses. Default: %(default)s",
default = 5)

arg_parser.add_argument("--timeout", type=int, metavar=('SECONDS'),
help="Time, in seconds, to wait for responses. Default: %(default)s",
default = 5)
arg_parser.add_argument("--csv-out", dest="csv_out",
help="Write results to the CSV file specified.")

args = arg_parser.parse_args()

if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)

# make a device object
this_device = LocalDeviceObject(
objectName=args.ini.objectname,
objectIdentifier=int(args.ini.objectidentifier),
maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),
segmentationSupported=args.ini.segmentationsupported,
vendorIdentifier=int(args.ini.vendoridentifier),
)
args = arg_parser.parse_args()

# build a bit string that knows about the bit names
pss = ServicesSupported()
pss['whoIs'] = 1
pss['iAm'] = 1
f = None

# set the property value to be just the bits
this_device.protocolServicesSupported = pss.value
if args.csv_out is not None:
f = open(args.csv_out, "wb")
field_names = ["address",
"device_id",
"max_apdu_length",
"segmentation_supported",
"vendor_id"]
this_csv_file = csv.DictWriter(f, field_names)
this_csv_file.writeheader()

# make a simple application
this_application = WhoIsIAmApplication(this_device, args.ini.address)
_log.debug("running")
if _debug: _log.debug("initialization")
if _debug: _log.debug(" - args: %r", args)

request = WhoIsRequest()
# make a device object
this_device = LocalDeviceObject(
objectName=args.ini.objectname,
objectIdentifier=int(args.ini.objectidentifier),
maxApduLengthAccepted=int(args.ini.maxapdulengthaccepted),
segmentationSupported=args.ini.segmentationsupported,
vendorIdentifier=int(args.ini.vendoridentifier),
)

if args.address is not None:
request.pduDestination = Address(args.address)
else:
request.pduDestination = GlobalBroadcast()
# build a bit string that knows about the bit names
pss = ServicesSupported()
pss['whoIs'] = 1
pss['iAm'] = 1

if args.range is not None:
request.deviceInstanceRangeLowLimit = int(args.range[0])
request.deviceInstanceRangeHighLimit = int(args.range[1])
# set the property value to be just the bits
this_device.protocolServicesSupported = pss.value

# make a simple application
this_application = WhoIsIAmApplication(this_device, args.ini.address)
_log.debug("running")

request = WhoIsRequest()

if args.address is not None:
request.pduDestination = Address(args.address)
else:
request.pduDestination = GlobalBroadcast()

if args.range is not None:
request.deviceInstanceRangeLowLimit = int(args.range[0])
request.deviceInstanceRangeHighLimit = int(args.range[1])

try:
#set timeout timer
def time_out():
time.sleep(args.timeout)
Expand All @@ -243,4 +272,6 @@ def time_out():
_log.exception("an error has occurred: %s", e)
finally:
_log.debug("finally")
if f is not None:
f.close()

Loading

0 comments on commit 5f3aedc

Please sign in to comment.