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 an alert the requirement to pop show up with 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 How to ContributeRequirement 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. To understand how to do this, please refer to VNFRQTS How to Contribute for more information on how to 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>
               <option value="VNF or PNF CSAR PACKAGE">VNF or PNF CSAR PACKAGE</option>
               <option value="VNF DOCUMENTATION PACKAGE">VNF DOCUMENTATION PACKAGE</option>
               <option value="PNF DOCUMENTATION PACKAGE">PNF DOCUMENTATION PACKAGE</option>
               <option 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="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>
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">
**MAY**">MAY</option>
            
<fieldset>
  </select>
            
<legend>Requirement<
</
legend>
p>
            <p>
              <label for="
id
introduced"
>Requirement ID
>Introduced:</label>
              
<input
<select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="
id" id="id" value="" type="text" readonly/
introduced">
            
</p>
   
<p> <label for="keyword">Keyword:</label>
<option value="amsterdam">amsterdam</option>
     
<select
 
style="width:
 
100%;
 
margin:
 
8px
 
0;
 
box-sizing:
 
border-box;
 
padding:
 
12px
 
20px;"
<option 
name
value="
keyword
beijing"
>
>beijing</option>
               <option value="
MUST
casablanca"
>MUST<
>casablanca</option>
               
<option value="dublin"
MUST
 
NOT">MUST NOT<
selected="selected">dublin</option>
               
<option value="
SHOULD">SHOULD<
el alto">el alto</option>
              </select>
  
<option value="SHOULD NOT">SHOULD NOT</option>
          </p>
           
<option value="MAY">MAY</option>
 <p>
              <label for="impacts">Impacts*:</
select>
label>
            
</p> <p>
  <select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="impacts" size="10" multiple>
               
<label
<option 
for
value="
target
AAI"
>Target:<
>AAI</
label>
option>
              
<select
 
style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="target">
<option value="AAF">AAF</option>
               <option value="
VNF
APPC"
>VNF<
>APPC</option>
               <option value="
VNFC
CLAMP"
>VNFC<
>CLAMP</option>
               
<option value="
VNF PROVIDER">VNF PROVIDER<
CCSDK">CCSDK</option>
               <option value="
VNF HEAT ORCHESTRATION TEMPLATE">VNF HEAT ORCHESTRATION TEMPLATE<
DCAE">DCAE</option>
               
<option value="
VNF PACKAGE">VNF PACKAGE<
Documentation">Documentation</option>
               <option value="
PNF
DCAE"
>PNF<
>DCAE</option>
               
<option value="
VNF
External 
or PNF
API"
>VNF
>External 
or PNF<
API</option>
               
</select>
<option value="Holmes">Holmes</option>
         
</p>
      
<p>
<option value="Integration">Integration</option>
               
<label
<option 
for
value="
introduced
Logging"
>Introduced:<
>Logging</
label>
option>
              
<select
 <option 
style
value="
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="introduced">
Micro Bus">Micro Bus</option>
               <option value="Modeling">Modeling</option>
               
<option value="
amsterdam">amsterdam<
Multi VIM">Multi VIM</option>
               <option value="
beijing
Music"
>beijing<
>Music</option>
               
<option value="
casablanca
CLI"
>casablanca<
>CLI</option>
               
<option value="
dublin
OOM"
>dublin<
>OOM</option>
               
<option value="
el alto">el alto<
OOF">OOF</option>
              
</select>
 <option value="Usecase UI">Usecase UI</option>
        
</p>
       <option value="Policy">Policy</option>
    
<p>
           <option 
<label for
value="
impacts">Impacts*:</label>
Portal">Portal</option>
               <option value="SDNC">SDNC</option>
    
<select
 
style="width:
 
100%;
 
margin:
 
8px
 
0;
 
box-sizing:
 
border-box;
 
padding:
 
12px
 
20px;" name="impacts" size
 <option value="
10" multiple>
SDC">SDC</option>
               
<option value="
AAI
SO"
>AAI<
>SO</option>
               <option value="
AAF
VFC"
>AAF<
>VFC</option>
               
<option value="
APPC
VID"
>APPC<
>VID</option>
               
<option value="
CLAMP
VNFSDK"
>CLAMP<
>VNFSDK</option>
               
<option value="
CCSDK
VNFRQTS"
>CCSDK<
>VNFRQTS</option>
               <option value="
DCAE
VVP"
>DCAE<
>VVP</option>
              </select>
           
<option value="Documentation">Documentation</option>
 </p>
            <p>
    
<option value="DCAE">DCAE</option>
          <b>*Hold down the Ctrl (windows) / Command (Mac) button 
<option value="ExternalAPI">External API</option>
to select multiple options for impacts.</b>
            
<option value="Holmes">Holmes</option>
</p>
            
<option value="Integration">Integration</option>
<p>
              <label 
<option value
for="
Logging">Logging</option>
validation_mode">Validation Mode:</label>
              <select 
<option value
style="
MicroBus">Micro Bus</option> <option value="Modeling">Modeling</option>
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="validation_mode">
               <option value="
MultiVIM">Multi VIM<
" selected disabled hidden>Select Validation Mode</option>
               <option value="
Music
static"
>Music<
>static</option>
               
<option value="
CLI
none"
>CLI<
>none</option>
              </select>
  
<option value="OOM">OOM</option>
          </p>
         
<option
 
value="OOF">OOF</option>
  <p>
              
<option
<label 
value
for="
UsecaseUI
requirementText"
>Usecase UI</option>
>Requirement Text:*</label>
              <textarea 
<option value
style="
Policy">Policy</option> <option value="Portal">Portal</option>
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" id="requirementText" rows="10" cols="30" class="required" value="" type="text"></textarea>
            </p>
    
<option
 
value="SDNC">SDNC</option>
       <p>
         
<option
 
value="SDC">SDC</option>
    <b>*Make sure to add keyword entered in KEYWORD field in the requirement 
<option value="SO">SO</option>
in CAPS.</b>
            
<option value="VFC">VFC</option>
</p>
          </fieldset>
       
<option value="VID">VID</option>
 </div>
      </div>
    </form>
    <button 
<option value="VNFSDK">VNFSDK</option> <option value="VNFRQTS">VNFRQTS</option>
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;" 
<option value="VVP">VVP</option>
rows="10" cols="30" id="formatted" readonly>
Formatted RST will Show here.
</textarea>

    <script>
      
<
//
select>
define template
      var template = $('#sections .section:first').clone();
  
</p>
    //define counter
      var 
<p>
sectionsCount = 1;
      var url = "https://wiki.onap.org/download/attachments/60887371/needs.json?api=v2"
   
*Hold down
 
the
 
Ctrl
 $(
windows) / Command (Mac) button to select multiple options for impacts.
'body').on('click', '#generate', function(e) {
        myFunction();
      });

    
</p>
  function myFunction() {
        
<p>
get(url).then(JSON.parse).then(function(data) {
          
<label for="validation_mode">Validation Mode:</label>
console.log("It worked!", data);
          
<select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="validation_mode">
return data;
        }).catch(function(err) {
          // Instead, this happens:
   
<option
 
value="static">static</option>
      console.log("It failed!", err);
        
<option value="none">none</option>
}).then(function(data) {
          var parsedData 
</select>
= parseIDs(data);
      
</p>
    var finalIDs = createIDs(1, parsedData);
    
<p>
      console.log(finalIDs);
        
<label
 
for="requirementText">Requirement Text:*</label>
 addSection(finalIDs);
        })
      }

  
<textarea
 
style="width:
 
100%;
 
margin:
 
8px 0; box-sizing: border-box; padding: 12px 20px;" name="requirementText" id="requirementText" rows="10" cols="30" value="" type="text">Enter Requirement text.</textarea>
function get(url) {
        // Return a new promise.
        return new Promise(function(resolve, reject) 
</p>
{
          
</fieldset>
// Do the usual XHR stuff
        
</div>
  var req = 
</div>
new XMLHttpRequest();
    
</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
 req.open('GET', url);
          req.onload = function() {
            // This is called even on 404 etc
            // so check the status
      
var
 
template
 
=
 
$('#sections
 
.section:first').clone();
  if (req.status == 
//define counter
200) {
      
var
 
sectionsCount
 
=
 
1;
     // 
var
Resolve 
url
the 
= "https://wiki.onap.org/download/attachments/60887371/needs.json?api=v2" $('body').on('click', '#generate', function(e) {
promise with the response text
              
myFunction
resolve(req.response);
      
});
      
$('body').on('click', '#convert', function(e)
} else {
        
convert();
      
}); function myFunction() {
// Otherwise reject with the status text
        
get(url).then(JSON.parse).then(function(data)
 
{
     // which will hopefully 
console.log("It worked!", data);
be a meaningful error
          
return
 
data;
   
}).catch(function(err) {
reject(Error(req.statusText));
           
//
 
Instead,
}
 
this
 
happens:
        };
  
console.log("It
 
failed!",
 
err);
      // 
}).then(function(data) {
Handle network errors
          
var
req.onerror 
parsedData
= 
parseIDs
function(
data
)
;
 {
          
var
 
finalIDs = createIDs(1, parsedData
 reject(Error("Network Error"));
          
console.log(finalIDs)
};
          // Make the 
alert(finalIDs);
request
          
addSection
req.send(
finalIDs
);
        });
      }

      function 
get
parseIDs(
url
jsonText) {
        
//
var 
Return
result 
a
= new 
promise. return new Promise(function(resolve, reject) {
Set();
        var version 
// Do the usual XHR stuff
= jsonText.current_version;
        result.add(Object.keys(jsonText["versions"][version]["needs"]));
    
var
 
req
 
=
 
new
 
XMLHttpRequest
console.log(result);
        
req.open('GET', url)
return result;
      }

    
req.onload
 
=
 function createIDs(numberOfIDs, parsedData) {
        var addedIDs 
// This is called even on 404 etc
= [];
        for (x = 0; x < numberOfIDs; 
// so check the status
x++) {
          var new_id = "";
   
if
 
(req.status
 
==
 
200)
 
{
   do {
          
//
 
Resolve
 
the
new_id 
promise with the response text
= (Math.floor(Math.random() * 999999));
            if (new_id < 
resolve(req.response);
100000) {
            
}
 
else
 
{
new_id = ('000000' + new_id).slice(-6);
          
//
 
Otherwise
 
reject
}
 
with
 
the
 
status
 
text
        new_id = ("R-" + 
// which will hopefully be a meaningful error
new_id);
          }
          while 
reject
(
Error(req.statusText
parsedData.has(new_id));
          addedIDs[x] = 
}
new_id;
        
}
;

        
// Handle network errors
return addedIDs;
      }

    
req.onerror
 
=
 function
() { reject(Error("Network Error"));
 addSection(finalIDs) {
        document.getElementById('id').value = 
}
finalIDs;
      }

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

    
if
  function buildRST(
field.type === 'button' || field.type === 'image' || field.type === 'submit' || !sKey) continue
o) {
        var rst = ".. req::\n";
        var arrayOfLines 
switch
= 
(field.type) {
$('#requirementText').val().split('\n');
        for (y in 
case 'checkbox':
o) {
          if 
o[sKey] = +field.checked;
(y == "requirementText") {
            for 
break;
(z in arrayOfLines) {
         
case
 
'radio':
    rst += "\n    " 
if (o[sKey] === undefined) o[sKey] = '';
+ arrayOfLines[z];
            }
        
if
 
(field.checked) o[sKey] = field.value;
 } else {
            rst += 
break;
"    :" + y + ": " + o[y] 
case 'select-multiple':
+ "\n";
          }
    
var
  
a
 
=
 
[];
}
        document.getElementById("formatted").innerHTML = rst;
    
for
 
(var
 
j
}

 
=
 
0,
 
jmax
 
=
 
field.options.length; j < jmax; ++j
 function formcheck() {
        var l = $(".required").length;
     
if (field.options[j].selected) a.push(field.options[j].value)
   var result = [];
        for (i = 0; i < l; i++) 
}
{
          //Push each element 
o[sKey] = a;
to the array
          if ($('.required').eq(i).val() == "") 
break;
{
            
default:
result.push($('.required')[i].name);
          }
    
o[sKey] = field.value;
    }
        if 
}
(result.length != 0) {
        
} buildRST(o
  alert("Please enter a value in: " + result);
        
return o;
}
      }

      function 
buildRST
buildReq(
o
fieldClicked) {
        var 
rst = "..req::\n\n"
addedTarget, addedKeword;
        var 
arrayOfLines
text = $('#requirementText
').val().split('\n') for (y in o) {
');
        
if (y == "requirementText"
switch (fieldClicked.id) {
          case 'target':
 
for
 
(z
 
in
 
arrayOfLines)
 
{
       addedTarget = 'The ' + 
fieldClicked.value 
rst
+
=
 
"\n " + arrayOfLines[z];
' ';
            text.val(text.val() + 
}
addedTarget);
          
}
 
else
 
{
break;
          case 'keyword':
 
rst
 
+=
 
"
    
:"
 
+
 
y
 
+
 
": " + o[y] + "\n"
 text.val(text.val() + fieldClicked.value);
          
}
  
}
break;
        
document.getElementById("demo").innerHTML = rst;
}
      }

    </script>
  </body>

</html>