Skip to content

Commit

Permalink
Add huawei motree cm parser #139
Browse files Browse the repository at this point in the history
  • Loading branch information
erssebaggala committed Oct 28, 2019
2 parents 55ec07f + ac0332a commit e5de3e6
Show file tree
Hide file tree
Showing 14 changed files with 186 additions and 27 deletions.
108 changes: 103 additions & 5 deletions background/background-process.html
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,32 @@ <h1>Background process</h1>
}



/**
* Clean Huawei GExport files.
*
* sed -i -r "
* s/<MO className="(BSC6900GSM|BSC6900UMTS|BSC6900GU|BSC6910GSM|BSC6910UMTS|BSC6910GU)(.*)/<MO className="\1/ig;
* " /mediation/data/cm/huawei/raw/motree/*.xml
*
* @exportFolder String Folder with the MO Tree dump XML files to be cleaned
*/
cleanHuaweiMOTreeFiles = async (exportFolder) => {
const replaceOptions = {
files: path.join(exportFolder,'*'),
from: [
/<MO className="(BSC6900GSM|BSC6900UMTS|BSC6900GU|BSC6910GSM|BSC6910UMTS|BSC6910GU)/g
],
to: [
"<MO className=\""
],
};

return await replace.sync(replaceOptions)
}



/*Use gnu sed.exe on windows
*
*/
Expand Down Expand Up @@ -379,6 +405,42 @@ <h1>Background process</h1>

}


/*
* Clean Huawei MO Tree XML files.
* @param string inputFolder
*/
cleanHuaweiMOTreeWithSed = (inputFolder) => {
let libPath = app.getAppPath();

if (!isDev) {
libPath = process.resourcesPath;
}

let files = fs.readdirSync(inputFolder, { withFileTypes: true }).filter(dirent => !dirent.isDirectory()).map(dirent => dirent.name);

const sedScript = path.join(libPath,'libraries', 'motree_cleanup.sed');
const sed = path.join(libPath,'libraries','sed.exe');

for (let i=0; i<files.length; i++) {
f = files[i];
inputFile = path.join(inputFolder,f);

log.info(`Cleaning ${f}...`);
sendLogToUI('parse_data','info', `Cleaning ${f}...`);

const child = spawnSync(sed, ['-i', '-r', '-f', sedScript, inputFile]);
log.info(`${sed} -i -r -f ${sedScript} ${inputFile}`);

if(child.error){
log.info(`[parse_cm_job] error:${child.error.toString()}`);
throw child.error.toString();
}
}

}


/*
* Take the latest file when there is more than one file from the same node .
*
Expand Down Expand Up @@ -460,7 +522,7 @@ <h1>Background process</h1>
removeDublicateHuaweiGExportFiles(inputFolder)

log.info(`[parse_cm_job] Uncompressing files GExport XML files...`)
sendLogToUI('parse_data','info',`Uncompressing files GExport XML files...` );
sendLogToUI('parse_data','info',"Uncompressing files GExport XML files...");

uncompressFolder(inputFolder);

Expand Down Expand Up @@ -488,17 +550,53 @@ <h1>Background process</h1>
}

}

//Clean Huawei MOTree files
else if(vendor === 'HUAWEI' && format === 'MOTREE_XML'){
try{

log.info(`Uncompressing files MOTree XML files...`);
sendLogToUI('parse_data','info', "Uncompressing files MOTree XML files...");

uncompressFolder(inputFolder);

log.info(`Uncompressing files MOTree XML files...`)
sendLogToUI('parse_data','info',"Cleaning MOTree XML files...");

if(process.platform === "win32"){
//If windows test, with sed.exe
cleanHuaweiMOTreeWithSed(inputFolder);
}else{
await cleanHuaweiMOTreeFiles(inputFolder);
}

log.info(`Cleanup of MOTree XML files completed.`);
sendLogToUI('parse_data','info',"Cleanup of MOTree XML files completed.");

}catch(error){
log.error('Error occurred:', error);
if(typeof error === 'undefined'){
sendLogToUI('parse_data','error', 'Error occured.');
return;
}
sendLogToUI('parse_data','error',error.toString());
return;
}

}


//Uncompress files for other vendor format combinations except huawei gexport
//The reason for this is we want to first remove the duplicates in the dumps, before wasting time
//uncompressing what does not need to be uncompressed
//else if(vendor !== 'HUAWEI' && format !== 'GEXPORT_XML'){
//else if(vendor !== 'HUAWEI' && (format !== 'GEXPORT_XML' || format !== 'MOTREE_XML')){
else{
sendLogToUI('parse_data','info',`Uncompressing files...` );
log.info(`Uncompressing files...`)
sendLogToUI('parse_data','info',"Uncompressing files...");
log.info("Uncompressing files...")
uncompressFolder(inputFolder);
}

sendLogToUI('parse_data','info', `Parsing files...`);
sendLogToUI('parse_data','info', "Parsing files...");
log.info("Parsing files...")


Expand Down
3 changes: 2 additions & 1 deletion background/boda-cell-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ const BCF_4G_PARAMS = {
longitude: {required: true},
height: {},
vendor: {},
cell_type: {}
cell_type: {},
localcellid: {}
};

const BCF_5G_PARAMS = {
Expand Down
39 changes: 31 additions & 8 deletions background/tems.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,10 @@ function generateParameterInsertQuery(fields, values){

paramNames.forEach((p, i) => {


//Skip parameter that are not there
if(fields.indexOf(p) === -1 ) return;

paramValues[i] = values[fields.indexOf(p)];
paramValues[i] = values[fields.indexOf(p)] === undefined ? "" : values[fields.indexOf(p)];
updatePhrase.push(`${p} = EXCLUDED.${p}`);
});

Expand All @@ -197,8 +196,7 @@ function generateParameterInsertQuery(fields, values){
SET
${updatePhrase.join(",")}
`;

//console.log(sql)

return sql;

}
Expand Down Expand Up @@ -429,7 +427,9 @@ async function loadXMLFile(fileName){ //@TODO: Confirm file is XML
"longitude",
"height",
"vendor",
"cell_type"
"cell_type",
"ci",
"localcellid"
]

//GSM_CELL
Expand Down Expand Up @@ -647,7 +647,10 @@ async function loadXMLFile(fileName){ //@TODO: Confirm file is XML

if(child.nodeName === 'LOCALCELLID') paramValues['localcellid'] = child.firstChild.data;

//pci
if(child.nodeName === 'PCI') paramValues['pci'] = child.firstChild.data;
if(child.nodeName === 'PHYSICAL_LAYER_CELL_ID') paramValues['pci'] = child.firstChild.data;


if(child.nodeName === 'EARFCN_DL') paramValues['euarfcn'] = child.firstChild.data;

Expand All @@ -668,6 +671,22 @@ async function loadXMLFile(fileName){ //@TODO: Confirm file is XML

if(child.nodeName === 'ENODE_B_STATUS') paramValues['status'] = child.firstChild.data;

//CGI
if(child.nodeName === 'LTE_CGI'){
const children2 = child.childNodes;
for(var j =0; j < children2.length; j++){
const child2 = children2[j];

if( typeof child2.localName === 'undefined') continue;

if(child2.nodeName === 'MCC') paramValues['mcc'] = child2.firstChild.data;
if(child2.nodeName === 'MNC') paramValues['mnc'] = child2.firstChild.data;
if(child2.nodeName === 'TAC') paramValues['tac'] = child2.firstChild.data;
}

paramValues['cgi'] = `${paramValues["mcc"]}-${paramValues["mnc"]}-${paramValues["lac"]}-${paramValues["ci"]}`
}

//POSITION
if(child.nodeName === 'POSITION'){
const children2 = child.childNodes;
Expand Down Expand Up @@ -699,10 +718,14 @@ async function loadXMLFile(fileName){ //@TODO: Confirm file is XML
paramValues['technology'] = 'lte';
paramValues['node'] = paramValues['siteid'] || "ENODEB";

const bcfLTEValues = lteBcfFields.map(v => paramValues[v] || '');
paramValues['ci'] = paramValues['ci'] || paramValues['pci'];
paramValues['localcellid'] = paramValues['localcellid'] === undefined ? "0" : '';

const InsertQry = generateParameterInsertQuery(lteBcfFields, bcfLTEValues);
await queryHelper.runQuery(InsertQry);
const bcfLTEValues = lteBcfFields.map(v => paramValues[v] === undefined ? "" : paramValues[v]);

const insertQry = generateParameterInsertQuery(lteBcfFields, bcfLTEValues);

await queryHelper.runQuery(insertQry);

node = nodes.iterateNext()
}
Expand Down
5 changes: 3 additions & 2 deletions background/vendor-formats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const VENDOR_CM_FORMATS = {
'ERICSSON': ['BULKCM','CNAIV2','BSM','EAW'],
'HUAWEI': ['GEXPORT_XML','NBI_XML','CFGMML', 'AUTOBAK_XML'],
'HUAWEI': ['GEXPORT_XML','NBI_XML','CFGMML', 'AUTOBAK_XML', 'MOTREE_XML'],
'ZTE': ['BULKCM','XLS'],
'NOKIA': ['RAML'],
'BODASTAGE': ['BCF_CSV']
Expand Down Expand Up @@ -35,7 +35,8 @@ const VENDOR_CM_PARSERS = {
'GEXPORT_XML': 'boda-huaweicmobjectparser.jar',
'CFGMML': 'boda-huaweimmlparser.jar',
'NBI_XML': 'boda-huaweicmxmlparser.jar',
'AUTOBAK_XML': 'boda-huaweicfgsynparser.jar'
'AUTOBAK_XML': 'boda-huaweicfgsynparser.jar',
'MOTREE_XML': 'boda-huaweicmmotreeparser.jar'
},
'ZTE': {
'BULKCM': 'boda-bulkcmparser.jar',
Expand Down
Binary file added libraries/boda-huaweicmmotreeparser.jar
Binary file not shown.
1 change: 1 addition & 0 deletions libraries/motree_cleanup.sed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
s/<MO className="(BSC6900GSM|BSC6900UMTS|BSC6900GU|BSC6910GSM|BSC6910UMTS|BSC6910GU)(.*)/<MO className="\2/g;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Boda-Lite",
"version": "0.4.2",
"version": "0.4.3",
"description": "Boda-Lite is a telecommunication network management application",
"private": true,
"homepage": "./",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/cm/VendorFormats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const VENDOR_CM_FORMATS = {
'ERICSSON': ['BULKCM','CNAIV2','BSM','EAW'],
'HUAWEI': ['GEXPORT_XML','NBI_XML','CFGMML', 'AUTOBAK_XML'],
'HUAWEI': ['GEXPORT_XML','NBI_XML','CFGMML', 'AUTOBAK_XML', "MOTREE_XML"],
'ZTE': ['BULKCM','XLS'],
'NOKIA': ['RAML'],
'MOTOROLA': ['CELL_X_EXPORT'],
Expand Down
5 changes: 2 additions & 3 deletions src/modules/reports/ReportsTree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ class ReportsTree extends React.Component{
<Menu>
<MenuItem icon="th" text="View report" onClick={(ev) => {ev.preventDefault(); this.showReportDataTab(node.label, node.reportId);}}/>
{node.inBuilt === true ? "" : <MenuItem icon="graph-remove" text="Delete report" onClick={(ev) => {ev.preventDefault(); this.removeReport(node.reportId);}}/> }
{node.inBuilt === true || node.type === 'composite' ?
<MenuItem icon="edit" text="Edit report" onClick={(ev) => {ev.preventDefault(); this.createCompositeReport(node.reportId)}} /> :
<MenuItem icon="edit" text="Edit report" onClick={(ev) => {ev.preventDefault(); this.showEditTab(node.reportId)}} /> }
{ node.inBuilt === false && node.type === 'composite' ? <MenuItem icon="edit" text="Edit report" onClick={(ev) => {ev.preventDefault(); this.createCompositeReport(node.reportId)}} /> : "" }
{ node.inBuilt === false && node.type !== 'composite' ? <MenuItem icon="edit" text="Edit report" onClick={(ev) => {ev.preventDefault(); this.createCompositeReport(node.reportId)}} /> : "" }

</Menu>,
{ left: e.clientX, top: e.clientY },
Expand Down
39 changes: 37 additions & 2 deletions src/modules/utilities/KMLGenerator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,25 @@ class KMLGenerator extends React.Component {
Specify the fields to show in the details popup dialog when each cell is clicked.
</div>
);


const radiusHelpContent = (
<div>
Specifiy the coverage radius in this section. The radius value can be <br/>
manaully in-put, selected from a column in the data file or can depend a series of conditions
</div>
);

const colorHelpContent = (
<div>
Pick or provide the color to use for the cell. If the color is manually <br />
provided, a <b>hexadecimal</b> color value of the form "<code>#FFFFFF</code>" is <br />
expected.
</div>
);


//

const processing = this.state.processing || this.props.processing;

Expand Down Expand Up @@ -1437,7 +1456,14 @@ class KMLGenerator extends React.Component {
<div>
<h6 className="horizontal-line">
<span className="horizontal-line-text">
Radius <Icon icon="chevron-right" />
Radius &nbsp;
<AntPopover
content={radiusHelpContent}
title={"? Radius"}
>
<Icon icon="info-sign" />
</AntPopover>
<Icon icon="chevron-right" />
</span>
</h6>
</div>
Expand All @@ -1454,7 +1480,16 @@ class KMLGenerator extends React.Component {
<div>
<h6 className="horizontal-line">
<span className="horizontal-line-text">
Colors <Icon icon="chevron-right" />

Colors &nbsp;
<AntPopover
content={colorHelpContent}
title={"? Color"}
>
<Icon icon="info-sign" />
</AntPopover>
<Icon icon="chevron-right" />

</span>
</h6>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const VERSION = "0.4.2";
export const VERSION = "0.4.3";

export default VERSION;
4 changes: 2 additions & 2 deletions website/pages/en/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class HomeSplash extends React.Component {
<div className="inner">
<ProjectTitle siteConfig={siteConfig} />
<PromoSection>
<Button href="https://github.com/bodastage/bts-ce-lite/releases/tag/v0.4.1">Download v0.4.1</Button>
<Button href="https://github.com/bodastage/bts-ce-lite/releases/tag/v0.4.2">Download v0.4.2</Button>
<Button href={docUrl('introduction.html#quick-start')}>Quick start</Button>
</PromoSection>
</div>
Expand Down Expand Up @@ -95,7 +95,7 @@ class Index extends React.Component {
// <div
// className="productShowcaseSection paddingBottom"
// style={{textAlign: 'center'}}>
// <h2><a href="https://github.com/bodastage/bts-ce-lite/releases">v0.4.1-alpha.5 is available for testing</a></h2>
// <h2><a href="https://github.com/bodastage/bts-ce-lite/releases">v0.4.2-alpha.5 is available for testing</a></h2>
// <MarkdownBlock>This is a pre-release version.</MarkdownBlock>
// </div>
//);
Expand Down
2 changes: 1 addition & 1 deletion website/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const siteConfig = {
zIndex: 100,
},

defaultVersionShown: '0.4.1',
defaultVersionShown: '0.4.2',
editUrl: 'https://github.com/bodastage/bts-ce-lite/edit/master/docs/',
};

Expand Down
1 change: 1 addition & 0 deletions website/versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"0.4.2",
"0.4.1",
"0.3.1",
"0.3.0",
Expand Down

0 comments on commit e5de3e6

Please sign in to comment.