Better file structure and naming

This commit is contained in:
Zaid Abdulla committed 2014-03-09 19:59:34 +03:00
1 parent 4a28e61cd0
commit 236a0241ba
25 files changed
+44 -49

No files matched your search

+8 -14
View File
@@ -1,20 +1,14 @@
* *~
!*.js .npmignore
config/*.js config/*
!config/*-sample.* !config/*-sample.*
!config/custom_commands
!tools/* debug/*
!debug/.gitkeep
lib/*.coffee
tools/*.coffee tools/*.coffee
!test/*
test/*.coffee test/*.coffee
!bin/genieacs-acs
!bin/genieacs-api
!bin/genieacs-files
!httpscert.key
!httpscert.crt
*~
+7 -7
View File
@@ -30,23 +30,23 @@ Alternatively, you can use git to get the latest development version (not recomm
Finally, run the following in GNU Screen session or something similar: Finally, run the following in GNU Screen session or something similar:
genieacs-acs genieacs-cwmp
This is the service that the CPEs will communicate with. It listens to port 7547 by default (see config/config.json). Configure the ACS URL of your devices accordingly. This is the service that the CPEs will communicate with. It listens to port 7547 by default (see config/config.json). Configure the ACS URL of your devices accordingly.
genieacs-api genieacs-nbi
This is the API module. It exposes the API on port 7557 by default. This is needed for the GUI front end to communicate with. This is the northbound interface module. It exposes a REST API on port 7557 by default. This is needed for the GUI front end to communicate with.
genieacs-files genieacs-fs
This is the file server from which the CPEs will download firmware images and other types of files. This is the file server from which the CPEs will download firmware images and other types of files.
You can use stream redirection to output to log files: You can use stream redirection to output to log files:
genieacs-acs >> /var/log/genieacs-acs.log 2>> /var/log/genieacs-acs-err.log genieacs-cwmp >> /var/log/genieacs-cwmp.log 2>> /var/log/genieacs-cwmp-err.log
genieacs-api >> /var/log/genieacs-api.log 2>> /var/log/genieacs-api-err.log genieacs-nbi >> /var/log/genieacs-nbi.log 2>> /var/log/genieacs-nbi-err.log
genieacs-files >> /var/log/genieacs-files.log 2>> /var/log/genieacs-files-err.log genieacs-fs >> /var/log/genieacs-fs.log 2>> /var/log/genieacs-fs-err.log
For further details about installation and configuration, refer to the [wiki section](https://github.com/zaidka/genieacs/wiki). For further details about installation and configuration, refer to the [wiki section](https://github.com/zaidka/genieacs/wiki).
+3 -3
View File
@@ -2,9 +2,9 @@
var path = require('path'); var path = require('path');
var fs = require('fs'); var fs = require('fs');
var dir = path.join(path.dirname(fs.realpathSync(__filename)), '../'); var dir = path.join(path.dirname(fs.realpathSync(__filename)), '../lib/');
process.title = 'genieacs-files'; process.title = 'genieacs-cwmp';
process.chdir(dir); process.chdir(dir);
require(path.join(dir, './files')); require(path.join(dir, './cwmp'));
+3 -3
View File
@@ -2,9 +2,9 @@
var path = require('path'); var path = require('path');
var fs = require('fs'); var fs = require('fs');
var dir = path.join(path.dirname(fs.realpathSync(__filename)), '../'); var dir = path.join(path.dirname(fs.realpathSync(__filename)), '../lib/');
process.title = 'genieacs-acs'; process.title = 'genieacs-fs';
process.chdir(dir); process.chdir(dir);
require(path.join(dir, './acs')); require(path.join(dir, './fs'));
+3 -3
View File
@@ -2,9 +2,9 @@
var path = require('path'); var path = require('path');
var fs = require('fs'); var fs = require('fs');
var dir = path.join(path.dirname(fs.realpathSync(__filename)), '../'); var dir = path.join(path.dirname(fs.realpathSync(__filename)), '../lib/');
process.title = 'genieacs-api'; process.title = 'genieacs-nbi';
process.chdir(dir); process.chdir(dir);
require(path.join(dir, './api')); require(path.join(dir, './nbi'));
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+5 -4
View File
@@ -30,14 +30,15 @@ exports.MONGODB_OPTIONS = {
} }
# load configuration # load configuration
c = require('./config/config') c = require('../config/config')
for k, v of c for k, v of c
exports[k] = v exports[k] = v
# load parameter configurations # load parameter configurations
exports.PARAMETERS = require('./config/parameters') exports.PARAMETERS = require('../config/parameters')
# load authentication scripts # load authentication scripts
exports.auth = require('./config/auth') exports.auth = require('../config/auth')
exports.CUSTOM_COMMANDS = require('../config/custom_commands')
exports.CUSTOM_COMMANDS = require('./config/custom_commands')
File renamed without changes.
+11 -11
View File
@@ -3,7 +3,7 @@ common = require './common'
util = require 'util' util = require 'util'
http = require 'http' http = require 'http'
https = require 'https' https = require 'https'
tr069 = require './tr-069' soap = require './soap'
tasks = require './tasks' tasks = require './tasks'
normalize = require('./normalize').normalize normalize = require('./normalize').normalize
db = require './db' db = require './db'
@@ -150,7 +150,7 @@ inform = (currentRequest, cwmpRequest) ->
updateAndRespond = () -> updateAndRespond = () ->
updateDevice(currentRequest, actions, (err) -> updateDevice(currentRequest, actions, (err) ->
throw err if err throw err if err
res = tr069.response(cwmpRequest.id, {methodResponse : {type : 'InformResponse'}}, {deviceId : currentRequest.deviceId}) res = soap.response(cwmpRequest.id, {methodResponse : {type : 'InformResponse'}}, {deviceId : currentRequest.deviceId})
writeResponse(currentRequest, res) writeResponse(currentRequest, res)
) )
@@ -245,7 +245,7 @@ runTask = (currentRequest, task, methodResponse) ->
f = () -> f = () ->
db.redisClient.setex(String(task._id), config.CACHE_DURATION, JSON.stringify(task), (err) -> db.redisClient.setex(String(task._id), config.CACHE_DURATION, JSON.stringify(task), (err) ->
throw err if err throw err if err
res = tr069.response(task._id, cwmpResponse) res = soap.response(task._id, cwmpResponse)
writeResponse(currentRequest, res) writeResponse(currentRequest, res)
) )
@@ -293,7 +293,7 @@ assertPresets = (currentRequest) ->
presetsHash = res[1] presetsHash = res[1]
if devicePresetsHash? and devicePresetsHash == presetsHash if devicePresetsHash? and devicePresetsHash == presetsHash
# no discrepancy, return empty response # no discrepancy, return empty response
res = tr069.response(null, {}) res = soap.response(null, {})
writeResponse(currentRequest, res) writeResponse(currentRequest, res)
else else
db.getPresetsObjectsAliases((allPresets, allObjects, allAliases) -> db.getPresetsObjectsAliases((allPresets, allObjects, allAliases) ->
@@ -334,7 +334,7 @@ assertPresets = (currentRequest) ->
runTask(currentRequest, task, {}) runTask(currentRequest, task, {})
) )
else else
res = tr069.response(null, {}, {}) res = soap.response(null, {}, {})
writeResponse(currentRequest, res) writeResponse(currentRequest, res)
) )
) )
@@ -392,7 +392,7 @@ listener = (httpRequest, httpResponse) ->
httpRequest.addListener 'end', () -> httpRequest.addListener 'end', () ->
cwmpResponse = {} cwmpResponse = {}
cwmpRequest = tr069.request(httpRequest) cwmpRequest = soap.request(httpRequest)
currentRequest = { currentRequest = {
httpRequest : httpRequest httpRequest : httpRequest
@@ -417,12 +417,12 @@ listener = (httpRequest, httpResponse) ->
# do nothing # do nothing
util.log("#{currentRequest.deviceId}: Transfer complete") util.log("#{currentRequest.deviceId}: Transfer complete")
cwmpResponse.methodResponse = {type : 'TransferCompleteResponse'} cwmpResponse.methodResponse = {type : 'TransferCompleteResponse'}
res = tr069.response(cwmpRequest.id, cwmpResponse, cookies) res = soap.response(cwmpRequest.id, cwmpResponse, cookies)
writeResponse(currentRequest, res) writeResponse(currentRequest, res)
else if cwmpRequest.methodRequest.type is 'RequestDownload' else if cwmpRequest.methodRequest.type is 'RequestDownload'
requestDownloadResponse = () -> requestDownloadResponse = () ->
cwmpResponse.methodResponse = {type : 'RequestDownloadResponse'} cwmpResponse.methodResponse = {type : 'RequestDownloadResponse'}
res = tr069.response(cwmpRequest.id, cwmpResponse, cookies) res = soap.response(cwmpRequest.id, cwmpResponse, cookies)
writeResponse(currentRequest, res) writeResponse(currentRequest, res)
fileType = cwmpRequest.methodRequest.fileType fileType = cwmpRequest.methodRequest.fileType
util.log("#{currentRequest.deviceId}: RequestDownload (#{fileType})") util.log("#{currentRequest.deviceId}: RequestDownload (#{fileType})")
@@ -480,7 +480,7 @@ listener = (httpRequest, httpResponse) ->
taskId = cwmpRequest.id taskId = cwmpRequest.id
if not taskId if not taskId
# Fault not related to a task. return empty response. # Fault not related to a task. return empty response.
res = tr069.response(null, {}, {}) res = soap.response(null, {}, {})
writeResponse(currentRequest, res) writeResponse(currentRequest, res)
return return
@@ -516,8 +516,8 @@ if cluster.isMaster
cluster.fork() cluster.fork()
else else
options = { options = {
key: fs.readFileSync('httpscert.key'), key: fs.readFileSync('../config/httpscert.key'),
cert: fs.readFileSync('httpscert.crt') cert: fs.readFileSync('../config/httpscert.crt')
} }
httpServer = http.createServer(listener) httpServer = http.createServer(listener)
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
+1 -1
View File
@@ -1,6 +1,6 @@
libxmljs = require 'libxmljs' libxmljs = require 'libxmljs'
SERVER_NAME = "GenieACS/#{require('./package.json').version}" SERVER_NAME = "GenieACS/#{require('../package.json').version}"
NAMESPACES = { NAMESPACES = {
'soap-enc' : 'http://schemas.xmlsoap.org/soap/encoding/', 'soap-enc' : 'http://schemas.xmlsoap.org/soap/encoding/',
View File
File renamed without changes.
+2 -2
View File
@@ -33,8 +33,8 @@
}, },
"scripts": { "scripts": {
"prepublish": "npm run compile", "prepublish": "npm run compile",
"compile": "coffee -cb *.coffee test/*.coffee tools/*.coffee", "compile": "coffee -cb lib/*.coffee test/*.coffee tools/*.coffee",
"configure": "cp ./config/config-sample.json ./config/config.json; cp ./config/parameters-sample.json ./config/parameters.json; cp ./config/custom_commands-sample.json ./config/custom_commands.json; cp ./config/auth-sample.js ./config/auth.js", "configure": "cp ./config/config-sample.json ./config/config.json; cp ./config/parameters-sample.json ./config/parameters.json; cp ./config/custom_commands-sample.json ./config/custom_commands.json; cp ./config/auth-sample.js ./config/auth.js; cp ./config/httpscert-sample.key ./config/httpscert.key; cp ./config/httpscert-sample.crt ./config/httpscert.crt",
"install": "npm run configure", "install": "npm run configure",
"test": "node test" "test": "node test"
} }
+1 -1
View File
@@ -1,4 +1,4 @@
common = require '../common' common = require '../lib/common'
NAMESPACES = { NAMESPACES = {
'soap-enc' : 'http://schemas.xmlsoap.org/soap/encoding/', 'soap-enc' : 'http://schemas.xmlsoap.org/soap/encoding/',