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

    <script>
      
<
//
p>
define template
      var template = 
<p>
$('#sections .section:first').clone();
      //define counter
      var 
<label
sectionsCount 
for
=
"validation_mode">Validation Mode:</label>
 1;
      var url 
<select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="validation_mode">
= "https://wiki.onap.org/download/attachments/60887371/needs.json?api=v2"
      $('body').on('click', '#generate', function(e) {
        myFunction();
      
<option value="static">static</option>
});

      function myFunction() {
        
<option value="none">none</option>
get(url).then(JSON.parse).then(function(data) {
          console.log("It worked!", data);
  
</select>
        return data;
   
</p>
     }).catch(function(err) {
        
<p>
  // Instead, this happens:
         
<label for="requirementText">Requirement Text:*</label>
 console.log("It failed!", err);
        }).then(function(data) {
        
<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>
 var parsedData = parseIDs(data);
          var finalIDs = createIDs(1, parsedData);
          console.log(finalIDs);
     
</p>
     addSection(finalIDs);
        
<p>
})
      }

      function get(url) {
  
*Make
 
sure
 
to
 
surround
 
your
 
keyword
 
with '**', for example, **MUST**
// Return a new promise.
        return new Promise(function(resolve, reject) 
</p>
{
  
</fieldset>
        
<
//
div>
 Do the usual XHR stuff
 
</div>
    
</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
 var req = new XMLHttpRequest();
          req.open('GET', url);
          req.onload = function() {
            // This is called even on 404 etc
          
var
 
template
 
= $('#sections .section:first').clone();
// so check the status
      
//define
 
counter
     if 
var sectionsCount = 1;
(req.status == 200) {
      
var
      
url
 
=
 
"https://wiki.onap.org/download/attachments
/
60887371
/
needs.json?api=v2" $('body').on('click', '#generate', function(e) {
 Resolve the 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 be a meaningful 
console.log("It worked!", data);
error
             
return data
 reject(Error(req.statusText));
        
}).catch(function(err)
 
{
   }
       
//
 
Instead,
 
this
 
happens:
};
          
console.log("It failed!", err);
// Handle network errors
        
}).then(
  req.onerror = function(
data
) {
          
var
 
parsedData = parseIDs(data
 reject(Error("Network Error"));
          
var
};
 
finalIDs
 
=
 
createIDs(1,
 
parsedData);
      // Make 
console.log(finalIDs);
the request
          
addSection
req.send(
finalIDs
);
        });
      }

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

      
req.open('GET', url);
function createIDs(numberOfIDs, parsedData) {
        var addedIDs = [];
  
req.onload
 
=
 
function()
 
{
   for (x = 0; x < numberOfIDs; x++) {
 
//
 
This
 
is
 
called
 
even
 
on
 
404
 
etc
  var new_id = "";
       
//
 
so
 
check
 
the
do 
status
{
            
if (req.status == 200) {
new_id = (Math.floor(Math.random() * 999999));
            if 
// Resolve the promise with the response text
(new_id < 100000) {
              new_id = ('000000' 
resolve(req.response
+ new_id).slice(-6);
            }
else {

            new_id 
// Otherwise reject with the status text
= ("R-" + new_id);
          
// which will hopefully be a meaningful error
}
          while 
reject(Error(req.statusText
(parsedData.has(new_id));
          addedIDs[x] 
}
= new_id;
        
}
;

        
// Handle network errors
return addedIDs;
      }

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

      function 
};
formDataToObject(elForm) {
        
//if 
Make the request
(!elForm instanceof Element) return;
        var fields = 
req
elForm.
send();
querySelectorAll('input, select, textarea'),
        
});
  o = {};
  
}
      
function
for 
parseIDs
(
jsonText)
var 
{
i = 0, imax = fields.length; i < 
var result = new Set();
imax; ++i) {
          var 
version
field = 
jsonText.current_version;
fields[i],
        
result.add(Object.keys(jsonText["versions"][version]["needs"]));
    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;
            
new_id = ("R-" + new_id);
case 'select-multiple':
        
}
      var a 
while (parsedData.has(new_id))
= [];
          
addedIDs[x]
 
=
 
new_id;
  
} return addedIDs;
for (var j = 0, jmax = field.options.length; j < jmax; ++j) {
    
}
      
function
 
addSection(finalIDs)
 
{
    if 
document.getElementById('id').value = finalIDs;
(field.options[j].selected) a.push(field.options[j].value);
        
}
      
function formDataToObject(elForm) {
}
            
//if
 
(!elForm instanceof Element) return
 o[sKey] = a;
        
var
  
fields
 
=
 
elForm.querySelectorAll('input,
 
select, textarea'),
 break;
          
o
 
=
 
{};
default:
        
for
  
(var
 
i
 
=
 
0, imax
 o[sKey] = 
fields
field.
length
value;
 
i
 
<
 
imax;
 
++i)
 
{
     }
     
var
 
field
 
=
 
fields[i],
}
        //formcheck();
    
sKey
 
=
 
field.name
 
|| field.id
 buildRST(o);
        return 
if (field.type === 'button' || field.type === 'image' || field.type === 'submit' || !sKey) continue;
o;
      }

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

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

     
var
 
arrayOfLines
function 
= $('#requirementText').val().split('\n')
buildReq(fieldClicked) {
        
for
var 
(y in o) {
addedTarget, addedKeword;
        var text 
if
= 
(y == "requirementText") {
$('#requirementText');
        switch (fieldClicked.id) {
     
for
 
(z
 
in
 
arrayOfLines)
 
{
 case 'target':
            
rst
addedTarget 
+
= 
"\n
'The ' + fieldClicked.value 
"
+ 
+ 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>