Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Warning
titleALERT
This macro has been removed by LF IT, a workaround is in progress.

How to use:

  1. Click on the "Generate ID" button and wait for the requirement to show up in the Requirement ID field.
  2. The Requirement ID will be passed into the "Requirement ID" field in the form.
  3. Fill out and edit the form as needed.
    1. Please fill out all fields, if you are not sure what to put, please refer to: VNFRQTS Requirement and Documentation Standards
  4. Click on the "Generate RST" button.
  5. There will be a new section added under with the requirement properly formatted into RST which can be copied and pasted to be used as needed.
    1. Moving forward, you can do one of two things with the generated RST:
      1. Copy and paste this into the JIRA ticket associated in: https://jira.onap.org/projects/VNFRQTS/issues/
      2. Copy and paste this into the appropriate Chapter and Section in the RST document cloned from: https://gerrit.onap.org/r/#/admin/projects/vnfrqts/requirements and submit a gerrit review.
        1. Refer To understand how to do this, please refer to VNFRQTS How to Contribute for more information on how to Contribute.set up the prerequisites for all necessary tools to make changes.
        2. NOTE: This tool ONLY generates the RST, it does not automatically add it to JIRA or into Gerrit, those will have to be done manually. It is important to understand how to make changes in Git/Gerrit before using this tool so please refer to: VNFRQTS How to Contribute
          1. If you still have any questions or concerns please contact: Hagop Bozawglanian
  6. video walkthrough. 


Expand


HTML

<html>

  <body>

    <button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; font-size: 24px;" id="generate">Generate ID</button>

    <form id="req">
      <div id="sections">
        <div class="section">
          <fieldset>
            <p>
              <label for="id">Requirement ID:</label>
              <input style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="id" id="id" value="" type="text" readonly class="required" />
            </p>
            <p>
              <label for="target">Target:</label>
              <select onchange="buildReq(target)" style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="target" id="target" class="required">
               <option value="" hidden>Select Target</option>
               <option value="VNF">VNF</option>
               <option value="PNF">PNF</option>
               <option value="VNF or PNF">VNF or PNF</option>
               <option value="VNF PROVIDER">VNF PROVIDER</option>
               <option value="PNF PROVIDER">PNF PROVIDER</option>
               <option value="VNF or PNF PROVIDER">VNF or PNF PROVIDER</option>
               <option value="VNF HEAT PACKAGE">VNF HEAT PACKAGE</option>
               <option value="VNF CSAR PACKAGE">VNF CSAR PACKAGE</option>
               <option value="PNF CSAR PACKAGE">PNF CSAR PACKAGE</option>
HTML
<html> <body> <button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; font-size: 24px;" id="generate">Generate ID</button> <form id="req">

      
<div
 
id="sections">
        
<div
<option 
class
value="
section">
VNF or PNF CSAR PACKAGE">VNF or PNF CSAR PACKAGE</option>
      
<fieldset>
         <option value="VNF 
<p>
DOCUMENTATION PACKAGE">VNF DOCUMENTATION PACKAGE</option>
              
<label
 <option 
for
value="
id">Requirement ID:</label>
PNF DOCUMENTATION PACKAGE">PNF DOCUMENTATION PACKAGE</option>
              
<input
 <option 
style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="id" id="id" value="" type="text" readonly/>
value="VNF or PNF DOCUMENTATION PACKAGE">VNF or PNF DOCUMENTATION PACKAGE</option>
              </select>
            </p>
            <p>
              <label for="keyword">Keyword:</label>
              <select onchange="buildReq(keyword)" style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="keyword" id="keyword" class="
keyword
required">
               <option value="" hidden>Select Keyword</option>
               <option value="**MUST**">MUST</option>
               
<option value="**MUST NOT**">MUST NOT</option>
               
<option value="**SHOULD**">SHOULD</option>
               
<option value="**SHOULD NOT**">SHOULD NOT</option>
               <option value="**MAY**">MAY</option>
              </select>
            </p>
            <p>
              <label for="
target
introduced"
>Target
>Introduced:</label>
              <select style="width
: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="target"> <option value="VNF">VNF</option> <option value="VNFC">VNFC</option>
: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="introduced">
               
<option value="
VNF PROVIDER">VNF PROVIDER<
amsterdam">amsterdam</option>
               
<option value="
VNF HEAT ORCHESTRATION TEMPLATE">VNF HEAT ORCHESTRATION TEMPLATE<
beijing">beijing</option>
               
<option value="
VNF PACKAGE">VNF PACKAGE<
casablanca">casablanca</option>
               
<option value="
PNF">PNF<
dublin" selected="selected">dublin</option>
               <option value="
VNF
el 
or PNF
alto"
>VNF
>el 
or PNF<
alto</option>
              </select>
            </p>
            <p>
              <label for="
introduced
impacts"
>Introduced
>Impacts*:</label>
              <select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding
: 12px 20px;" name="introduced">
: 12px 20px;" name="impacts" size="10" multiple>
               <option value="AAI">AAI</option>
               <option value="AAF">AAF</option>
               <option value="
amsterdam
APPC"
>amsterdam<
>APPC</option>
               <option value="
beijing
CLAMP"
>beijing<
>CLAMP</option>
               <option value="
casablanca
CCSDK"
>casablanca<
>CCSDK</option>
               <option value="
dublin" selected="selected">dublin<
DCAE">DCAE</option>
               
<option value="
el alto">el alto<
Documentation">Documentation</option>
               
</select>
<option value="DCAE">DCAE</option>
               <option value="External API">External API</option>
    
</p>
           
<p>
<option value="Holmes">Holmes</option>
              
<label
 <option 
for
value="
impacts">Impacts*:</label>
Integration">Integration</option>
              
<select
 <option 
style
value="
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="impacts" size="10" multiple>
Logging">Logging</option>
               <option value="Micro Bus">Micro Bus</option>
               <option value="
AAI
Modeling"
>AAI<
>Modeling</option>
               <option value="
AAF">AAF<
Multi VIM">Multi VIM</option>
               
<option value="
APPC
Music"
>APPC<
>Music</option>
               
<option value="
CLAMP
CLI"
>CLAMP<
>CLI</option>
               
<option value="
CCSDK
OOM"
>CCSDK<
>OOM</option>
               
<option value="
DCAE
OOF"
>DCAE<
>OOF</option>
               
<option value="
Documentation">Documentation<
Usecase UI">Usecase UI</option>
               
<option value="
DCAE
Policy"
>DCAE<
>Policy</option>
               
<option value="
ExternalAPI
Portal"
>External API<
>Portal</option>
               <option value="
Holmes
SDNC"
>Holmes<
>SDNC</option>
               
<option value="
Integration
SDC"
>Integration<
>SDC</option>
               
<option value="
Logging
SO"
>Logging<
>SO</option>
               <option value="
MicroBus
VFC"
>Micro Bus<
>VFC</option>
               
<option value="
Modeling
VID"
>Modeling<
>VID</option>
               
<option value="
MultiVIM
VNFSDK"
>Multi VIM<
>VNFSDK</option>
               <option value="
Music
VNFRQTS"
>Music<
>VNFRQTS</option>
               <option value="
CLI
VVP"
>CLI<
>VVP</option>
              </select>
      
<option
 
value="OOM">OOM</option>
     </p>
           
<option value="OOF">OOF</option>
 <p>
              <b>*Hold down 
<option value="UsecaseUI">Usecase UI</option>
the Ctrl (windows) / Command (Mac) button to select multiple options for impacts.</b>
      
<option
 
value="Policy">Policy</option>
     </p>
           
<option value="Portal">Portal</option>
 <p>
              <label 
<option value
for="
SDNC">SDNC</option>
validation_mode">Validation Mode:</label>
        
<option value="SDC">SDC</option>
      <select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 
<option
20px;" 
value
name="
SO">SO</option>
validation_mode">
               
<option value="
VFC">VFC<
" selected disabled hidden>Select Validation Mode</option>
               
<option value="
VID
static"
>VID<
>static</option>
               
<option value="
VNFSDK
none"
>VNFSDK<
>none</option>
              
<option value="VNFRQTS">VNFRQTS</option>
</select>
            
<option value="VVP">VVP</option>
</p>
            <p>
    
</select>
          <label for="requirementText">Requirement Text:*</
p>
label>
            
<p>
  <textarea style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" 
<b>*Hold down the Ctrl (windows) / Command (Mac) button to select multiple options for impacts.</b>
id="requirementText" rows="10" cols="30" class="required" value="" type="text"></textarea>
            </p>
            
</p>
<p>
            
<p>
  <b>*Make sure to add keyword entered in KEYWORD field in the requirement 
<label for="validation_mode">Validation Mode:</label>
in CAPS.</b>
            
<select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="validation_mode">
</p>
          </fieldset>
        </div>
      </div>
   
<option value="static">static</option>
 </form>
    <button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; 
<option value="none">none</option>
font-size: 24px;" onclick="formDataToObject(document.getElementById('req'))">Convert to RST</button>
    <textarea style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 
</select> </p>
12px 20px;" rows="10" cols="30" id="formatted" readonly>
Formatted RST will Show here.
</textarea>

    <script>
      //define 
<p>
template
      var template = 
<label for="requirementText">Requirement Text:*</label>
$('#sections .section:first').clone();
      //define counter
   
<textarea style="width:
 
100%;
 
margin:
 
8px
var 
0; box-sizing: border-box; padding: 12px 20px;" name="requirementText" id="requirementText" rows="10" cols="30" value="" type="text">Enter Requirement text.</textarea>
sectionsCount = 1;
      var url = "https://wiki.onap.org/download/attachments/60887371/needs.json?api=v2"
      $('body').on('click', '#generate', function(e) {
   
</p>
     myFunction();
      
<p>
});

      function myFunction() {
      
<b>*Make
 
sure to add keyword entered in KEYWORD field in the requirement in CAPS.</b>
 get(url).then(JSON.parse).then(function(data) {
          console.log("It worked!", data);
          
</p>
return data;
        
</fieldset>
}).catch(function(err) {
        
</div>
  // Instead, this 
</div>
happens:
     
</form>
    
<button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; font-size: 24px;" onclick="formDataToObject(document.getElementById('req'))">Convert to RST</button> <textarea style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" rows="10" cols="30" id="demo" readonly> Formatted RST will Show here. </textarea> <script> //define template
 console.log("It failed!", err);
        }).then(function(data) {
          var parsedData = parseIDs(data);
          var finalIDs = createIDs(1, parsedData);
          console.log(finalIDs);
      
var
 
template
 
=
 
$('#sections .section:first').clone(
 addSection(finalIDs);
       
//define
 
counter
})
      }

    
var
  
sectionsCount = 1;
function get(url) {
      
var
 
url
 
= "https://wiki.onap.org/download/attachments/60887371/needs.json?api=v2"
// Return a new promise.
        
$('body').on('click', '#generate', function(e
return new Promise(function(resolve, reject) {
        
myFunction(); });
  // Do the usual XHR stuff
      
$('body').on('click', '#convert', function(e)
 
{
   var req = new 
convert
XMLHttpRequest();
      
});
    req.open('GET', url);
   
function
 
myFunction()
 
{
     req.onload 
get(url).then(JSON.parse).then(
= function(
data
) {
          
console.log("It
 
worked!", data); return data;
 // This is called even on 404 etc
        
}).catch(function(err)
 
{
   // so check 
// Instead, this happens:
the status
            if 
console.log("It failed!", err);
(req.status == 200) {
        
}).then(function(data)
 
{
     // Resolve the promise with 
var
the 
parsedData
response 
= parseIDs(data);
text
           
var
 
finalIDs
 
=
 
createIDs(1, parsedData
resolve(req.response);
        
console.log(finalIDs);
    } else {
    
addSection(finalIDs);
        
})
  // Otherwise reject with 
}
the status text
    
function
 
get(url)
 
{
        // 
Return
which 
a
will 
new
hopefully 
promise.
be a meaningful error
     
return
 
new
 
Promise(function(resolve,
 
reject)
 
{
     reject(Error(req.statusText));
     
//
 
Do
 
the
 
usual XHR stuff
    }
      
var
 
req
 
=
 
new
 
XMLHttpRequest()
};
          
req.open('GET', url);
// Handle network errors
          req.
onload
onerror = function() {
            
// This is called even on 404 etc
reject(Error("Network Error"));
          };
          // 
so
Make 
check
the 
status
request
         
if
 
(
req.
status == 200) {
send();
        });
      }

 
//
 
Resolve
 
the
 
promise
 
with
 
the response text
function parseIDs(jsonText) {
        var result = new 
resolve(req.response
Set();
        var version 
} else {
= jsonText.current_version;
        
// Otherwise reject with the status text
result.add(Object.keys(jsonText["versions"][version]["needs"]));
        console.log(result);
        return result;
     
//
 
which
}

 
will
 
hopefully
 
be
 
a
 
meaningful
 
error
function createIDs(numberOfIDs, parsedData) {
        var addedIDs 
reject(Error(req.statusText))
= [];
        for (x = 0; 
}
x < numberOfIDs; 
};
x++) {
          
// Handle network errors
var new_id = "";
          
req.onerror = function() {
do {
            new_id = 
reject(Error("Network Error"
(Math.floor(Math.random() * 999999));
          
};
  if (new_id < 100000) {
    
//
 
Make
 
the
 
request
       new_id = 
req.send(
('000000' + new_id).slice(-6);
            }
);

      
}
      new_id 
function
= 
parseIDs(jsonText) {
("R-" + new_id);
        
var
 
result = new Set();
 }
        
var
 
version
 
=
while 
jsonText.current_version
(parsedData.has(new_id));
        
result.add(Object.keys(jsonText["versions"][version]["needs"]))
  addedIDs[x] = new_id;
        
console.log(result);
}
        return 
result
addedIDs;
      }

      function 
createIDs(numberOfIDs, parsedData
addSection(finalIDs) {
        
var addedIDs
document.getElementById('id').value = 
[]
finalIDs;
      }

  
for
 
(x
 
=
 
0;
 
x < numberOfIDs; x++
function formDataToObject(elForm) {
        
var new_id = ""
//if (!elForm instanceof Element) return;
        var fields 
do {
= elForm.querySelectorAll('input, select, textarea'),
          
new_id
o =
(Math.floor(Math.random() * 999999));
 {};
        for (var i = 0, imax = 
if (new_id
fields.length; i < 
100000
imax; ++i) {
          var field = 
new_id = ('000000' + new_id).slice(-6);
fields[i],
            sKey = field.name 
}
|| field.id;
          if 
new_id = ("R-" + new_id); }
(field.type === 'button' || field.type === 'image' || field.type === 'submit' || !sKey) continue;
          
while
switch (
parsedData.has(new_id));
field.type) {
          
addedIDs[x] = new_id;
  case 'checkbox':
        
}
      o[sKey] 
return addedIDs
= +field.checked;
       
}
       break;
  
function
 
addSection(finalIDs) {
         case 
document.getElementById(
'
id').value = finalIDs;
radio':
        
}
      
function
if 
formDataToObject(elForm) {
(o[sKey] === undefined) o[sKey] = '';
    
//if
 
(!elForm
 
instanceof
 
Element)
 
return;
      if 
var fields = elForm.querySelectorAll('input, select, textarea'),
(field.checked) o[sKey] = field.value;
            
o
 
=
 
{}
break;
        
for
 
(var
 
i
 
=
 
0, imax = fields.length; i < imax; ++i) {
case 'select-multiple':
              var 
field
a = 
fields
[
i
]
,
;
            
sKey
 
=
 
field.name || field.id; if (field.type === 'button' || field.type === 'image' || field.type === 'submit' || !sKey) continue;
for (var j = 0, jmax = field.options.length; j < jmax; ++j) {
                if 
switch (field.type) {
(field.options[j].selected) a.push(field.options[j].value);
             
case
 
'checkbox':
}
              o[sKey] = 
+field.checked
a;
              break;
            
case 'radio'
default:
             
if
 
(
o[sKey] =
== undefined) o[sKey] = '';
 field.value;
          }
        }
       
if
 //formcheck(
field.checked) o[sKey] = field.value
);
        buildRST(o);
        return o;
      
break;
}

      function buildRST(o) {
    
case
 
'select-multiple':
   var rst = ".. req::\n";
        var 
a
arrayOfLines = 
[]
$('#requirementText').val().split('\n');
        for (y in o) {
  
for
 
(var
 
j
 
=
 
0,
 
jmax
 
=
 
field.options.length; j < jmax; ++j
 if (y == "requirementText") {
            for (z in arrayOfLines) 
if (field.options[j].selected) a.push(field.options[j].value);
{
              rst 
}
+= "\n    " + arrayOfLines[z];
        
o[sKey]
 
=
 
a;
  }
          } else 
break;
{
            
default:
rst += "    :" + y + ": " 
+ o[
sKey
y] 
= field.value
+ "\n";
          }
        }
        
buildRST(o)
document.getElementById("formatted").innerHTML = rst;
      }

     
return
 
o;
function formcheck() {
    
}
    var l 
function
= 
buildRST(o) {
$(".required").length;
        var 
rst
result = 
"..req::\n\n"
[];
        
var
for 
arrayOfLines
(i =
$('#requirementText').val().split('\n');
 0; i < l; i++) {
        
var keyW = document.getElementById("keyword");
  //Push each element to the array
        
var
 
keyWord
 
= keyW.options[keyW.selectedIndex].text;
if ($('.required').eq(i).val() == "") {
        
for
  
(y
 
in o) {
 result.push($('.required')[i].name);
          
if
}
 
(y
 
==
 
"requirementText")
 
{
    }
        
for
if (
z in arrayOfLines
result.length != 0) {
          alert("Please enter a value in: " 
var finLine = boldString(arrayOfLines[z], keyWord
+ result);
        }
      
rst
}

 
+=
 
"\n
    
" + finLine;
function buildReq(fieldClicked) {
        var 
}
addedTarget, addedKeword;
        var text 
} else {
= $('#requirementText');
        switch (fieldClicked.id) {
  
rst
 
+=
 
"
    
:"
 
+
 
y + ": " + o[y] + "\n";
case 'target':
            addedTarget = 
}
'The ' + fieldClicked.value + ' ';
    
}
        
document.getElementById("demo").innerHTML = rst;
text.val(text.val() + addedTarget);
            
}
break;
        
function
 
boldString(str, find) {
 case 'keyword':
        
var
 
re
 
=
 
new RegExp(find, 'g'
 text.val(text.val() + fieldClicked.value);
            break;
  
return
 
str.replace(re,
 
'**'
 
+
 
find
 
+ '**');
 }
      }

    </script>
  </body>

</html>