pktgen: Not able to send vlan tagged traffic using .lua script - dpdk

I need right format for enabling vlan while sending traffic through lua script,
following format is working without error, but it send traffic without vlan tag, not sure what is missing here, please help
pktgen.range.dst_mac("0", "start", "00:00:5e:00:01:00");
pktgen.range.src_mac("0", "start", "00:16:00:01:00:01");
pktgen.range.src_mac("0", "inc", "00:00:00:00:00:01");
pktgen.range.src_mac("0", "min", "00:16:00:01:00:01");
pktgen.range.src_mac("0", "max", "00:16:00:01:00:cd");
pktgen.range.src_ip("0", "start", "1.1.1.1");
pktgen.range.src_ip("0", "inc", "0.0.0.0");
pktgen.range.src_ip("0", "mint", "1.1.1.1");
pktgen.range.src_ip("0", "max", "1.1.1.1");
pktgen.range.dst_ip("0", "start", "1.1.1.2");
pktgen.range.dst_ip("0", "inc", "0.0.0.0");
pktgen.range.dst_ip("0", "mint", "1.1.1.2");
pktgen.range.dst_ip("0", "max", "1.1.1.2");
pktgen.set_type("0", "ipv4");
pktgen.set_proto("0", "udp");
pktgen.set("0", "size", 1024);
pktgen.set("0", "rate", 0.25);
pktgen.set("0", "burst", 1);
pktgen.set_range("all", "on");
pktgen.vlanid("0", 9);
local port ="0";
pktgen.start(port);

As mentioned in the comments, the vlan enable is not triggered in the LUA scripts which causes VLAN not to be enabled. I have modified the above lua script to enable vlan,
please find the details below
package.path = package.path ..";?.lua;test/?.lua;app/?.lua;"
require "Pktgen"
-- enable vlan feature, default setting is disabled.
pktgen.vlan("all", "enable");
pktgen.range.dst_mac("0", "start", "00:00:5e:00:01:00");
pktgen.range.src_mac("0", "start", "00:16:00:01:00:01");
pktgen.range.src_mac("0", "inc", "00:00:00:00:00:01");
pktgen.range.src_mac("0", "min", "00:16:00:01:00:01");
pktgen.range.src_mac("0", "max", "00:16:00:01:00:cd");
pktgen.range.src_ip("0", "start", "1.1.1.1");
pktgen.range.src_ip("0", "inc", "0.0.0.0");
pktgen.range.src_ip("0", "mint", "1.1.1.1");
pktgen.range.src_ip("0", "max", "1.1.1.1");
pktgen.range.dst_ip("0", "start", "1.1.1.2");
pktgen.range.dst_ip("0", "inc", "0.0.0.0");
pktgen.range.dst_ip("0", "mint", "1.1.1.2");
pktgen.range.dst_ip("0", "max", "1.1.1.2");
pktgen.set_type("0", "ipv4");
pktgen.set_proto("0", "udp");
pktgen.set("0", "size", 1024);
pktgen.set("0", "rate", 0.25);
pktgen.set("0", "burst", 1);
pktgen.set_range("all", "on");
pktgen.vlanid("0", 9);
pktgen.start(port);
Note:
there are 2 options in pktgen to run the lua from command line use option -f, and within interactive mode use script option.
results for without running the script (left side) and result for after running the script (right side) shared in the image below

Related

Module parse failed: Unexpected character '�' After updating to angular 12

After upgrading Angular from v.11 to v.12 I am getting the following Error
home.Component.ts
imgname= require("../assets/images/imgname.png");
./src/assets/images/imgname.png:1:0 - Error: Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
"devDependencies": {
"#angular-devkit/build-angular": "^12.0.1",
"#angular/cli": "~12.0.1",
"#angular/compiler-cli": "~12.0.1",
"#angular/language-service": "~12.0.1",
"#types/jasmine": "~3.7.4",
"#types/jasminewd2": "~2.0.9",
"#types/node": "^15.6.1",
"css-loader": "5.2.6",
"html-webpack-plugin": "^5.3.1",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.6.0",
"mini-css-extract-plugin": "~1.6.0",
"protractor": "~7.0.0",
"ts-loader": "9.2.2",
"ts-node": "~10.0.0",
"tslint": "~6.1.0",
"typescript": "~4.2.4"
"webpack": "~5.37.1",
"webpack-bundle-analyzer": "^4.4.2",
"webpack-cli": "^4.7.0"
}
angular.json
"assets": [
"src/favicon.ico",
"src/assets",
]
Unfortunately I cannot answer but may have some more information. I seem to be having a similar issue though on upgrading to Angular v12. I believe in my case it relates to executing the following in my Angular.json. In my case the lines are trying to copy assets for the use of Leaflet within angular and its is no longer able to copy the .png assets.
...
"assets": [
{
"glob": "**/*",
"input": "./node_modules/leaflet/dist/images",
"output": "/assets/leaflet/"
}
],
...
Thanks
I was able to solve this issue by adding file-loader! prefix before the path:
imgname = require("file-loader!../assets/images/imgname.png");
Also, you can try another approach described in this answer https://stackoverflow.com/a/67932447/8171860

Unexpected token error when migrating to native classes for components

I upgraded to Ember 3.11 and I want to start using native classes for my components.
When I change a component class to something similar like:
export default class MyClassName extends BaseComponent {
myFieldName;
}
I get a build error
"Parsing error: Unexpected token ;" because of the class field.
Ideas how to make sure ember-cli doesn't complain about the new syntax are more than welcome.
Thanks
UPDATE:
Following jelhan's suggestion below I updated my package.json file as in ember-cli/ember-new-output (https://github.com/ember-cli/ember-new-output/blob/master/package.json). This didn’t help. I also created a brand new ember project with a single component in it and I still have the same problem.
This is the package.json file which gets generated when creating new ember project (ember-cli 3.11.0):
{
"name": "my-project",
"version": "0.0.0",
"private": true,
"description": "Small description for my-project goes here",
"repository": "",
"license": "MIT",
"author": "",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint .",
"start": "ember serve",
"test": "ember test"
},
"devDependencies": {
"#ember/jquery": "^0.6.0",
"#ember/optional-features": "^0.7.0",
"broccoli-asset-rev": "^3.0.0",
"ember-ajax": "^5.0.0",
"ember-cli": "~3.11.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.7.3",
"ember-cli-dependency-checker": "^3.1.0",
"ember-cli-eslint": "^5.1.0",
"ember-cli-htmlbars": "^3.0.1",
"ember-cli-htmlbars-inline-precompile": "^2.1.0",
"ember-cli-inject-live-reload": "^1.8.2",
"ember-cli-sri": "^2.1.1",
"ember-cli-template-lint": "^1.0.0-beta.1",
"ember-cli-uglify": "^2.1.0",
"ember-data": "~3.11.0",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^2.0.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-qunit": "^4.4.1",
"ember-resolver": "^5.0.1",
"ember-source": "~3.11.1",
"ember-welcome-page": "^4.0.0",
"eslint-plugin-ember": "^6.2.0",
"eslint-plugin-node": "^9.0.1",
"loader.js": "^4.7.0",
"qunit-dom": "^0.8.4"
},
"engines": {
"node": "8.* || >= 10.*"
}
}
Seems like the new syntax works fine. The javascript code executes as expected. I guess the errors I see in the build output are eslint errors only. I need to figure out how to configure eslint to understand the new syntax.
as #Lux pointed out in a comment, the value is missing.
This will fix your syntax error:
export default class MyClassName extends BaseComponent {
myFieldName = undefined;
}
Also, be sure to have the latest version of ember-cli-babel installed to ensure that you have the latest bundled set of babel plugins -- earlier versions of ember-cli-babel did not support classes. The latest at the time of writing this is 7.10.0 https://www.npmjs.com/package/ember-cli-babel
In classic syntax, this would be the equivalent of:
export default BaseComponent.extend({
myFieldName: undefined,
});
If you're curious about more of the differences -- here is a bit more information on native javascript classes in Ember from the ember-decorators documentation: https://ember-decorators.github.io/ember-decorators/docs/native-class-basics
On a somewhat related note:
I know it's been common in Ember to define all the properties a component may receive at the top to declare its API, but now is actually a really good time to get in to TypeScript, so that you may add more semantic meaning to your classes.
Initializing a property as undefined is the same as not specifying it, so with TypeScript, you can attain better semantics with:
interface Args {
myFieldName: string;
}
export default class MyClassName extends BaseComponent<Args> {
}
Assuming BaseComponent is a Glimmer Component, info here: https://octane-guides-preview.emberjs.com/release/upgrading/editions/#toc_tracked-properties
(EmberComponents don't accept Type Arguments, as far as I know)

How to create a expandable nested list visual in Power BI

How to create expandable nested list visual in Power BI which something looks like below image.
I tried searching on internet but couldn't find anything related.
Just use a matrix visual and right click on the desired group level to set your toggles:
As a custom visual, you can use basic Bootstrap and jQuery to develop the intended UI mentioned in your question.
If you are new to creating a custom visual, you can follow these steps: https://learn.microsoft.com/en-us/power-bi/developer/custom-visual-develop-tutorial
I would suggest using the webpack configuration instead of basic PBIVIZ. For more information, Visit https://github.com/Microsoft/powerbi-visuals-webpack-plugin#webpack-configuration
You can install the required dependencies in your package.json file of custom visual. This is how my basic package.json looks like which helps me creating visual as you mentioned in the question.
{
"name": "visual",
"scripts": {
"pbiviz": "pbiviz",
"pb-start": "pbiviz start",
"start": "webpack-dev-server",
"package": "pbiviz package",
"cert": "pbiviz --install-cert",
"develop": "webpack --mode development --watch",
"build": "webpack --mode production"
},
"dependencies": {
"#babel/core": "^7.4.3",
"#babel/polyfill": "7.0.0",
"#babel/preset-env": "^7.4.3",
"#babel/runtime": "^7.1.5",
"#babel/runtime-corejs2": "^7.1.5",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"daterangepicker": "2.1.25",
"extra-watch-webpack-plugin": "^1.0.3",
"jquery": "^3.2.1",
"json-loader": "^0.5.7",
"less": "3.8.0",
"less-loader": "^4.1.0",
"mini-css-extract-plugin": "^0.6.0",
"moment": "^2.24.0",
"powerbi-models": "^1.1.0",
"powerbi-visuals-api": "~2.2.0",
"powerbi-visuals-utils-dataviewutils": "2.0.1",
"powerbi-visuals-utils-typeutils": "^2.1.0",
"powerbi-visuals-webpack-plugin": "^2.1.2",
"style-loader": "^0.23.1",
"webpack-visualizer-plugin": "^0.1.11"
},
"devDependencies": {
"#types/node": "^12.0.0",
"#types/webpack": "^4.4.31",
"#types/daterangepicker": "^2.1.17",
"#types/jquery": "^2.0.41",
"ts-loader": "4.5.0",
"ts-node": "^8.1.0",
"typescript": "^3.0.1",
"webpack": "^4.30.0",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.3.1"
}
}
To create a table, you would have to use jQuery to create and append the HTML in visual. To expand and collapse a particular list, you can use jQuery/Javascript/Bootstrap in your visual.

Any idea why cloneDeep is broken in apollo-utilities with vue, nginx and aws

Someone has an idea why a project compiled for production, runs well in local, when I deploy it in aws with the same environment, almost all the queries to graphql throw the error:
TypeError: property descriptors must not specify a value or be writable when a getter or setter has been specified
Local OS:
nginx 1.14
manjaro 18
Remote OS (AWS):
nginx 1.14
Ubuntu 18.04
Package.json dependencies, both enviroments:
"#mdi/font": "^2.5.94",
"apollo-cache-inmemory": "^1.2.5",
"apollo-client": "^2.4.3",
"apollo-link-context": "^1.0.8",
"apollo-link-http": "^1.5.4",
"apollo-server": "^2.1.0",
"apollo-upload-client": "^9.0.0",
"axios": "^0.18.0",
"buefy": "^0.6.7",
"cors": "^2.8.4",
"express": "^4.16.3",
"graphql": "^0.12.3",
"graphql-tag": "^2.6.1",
"moment": "^2.22.2",
"nprogress": "^0.2.0",
"sendmail": "^1.4.1",
"serve-static": "^1.13.2",
"vue": "^2.5.2",
"vue-apollo": "^3.0.0-alpha.3",
"vue-axios": "^2.1.3",
"vue-clipboard2": "^0.2.1",
"vue-router": "^3.0.1",
"vuelidate": "^0.7.4",
"vuex": "^3.0.1"

The Broccoli Plugin: [UglifyWriter] failed with

I've had this error for 2 weeks now while trying to build an ember app in production. Building it in dev environment works fine. I also realized that disabling minifyJs in ember-cli-build prevents the error but then, the app gets stuck at loading in the browser, and in the console, I see another error: "could not import ember-resolver".
My guess is that this is as a result of the UglifyWriter not understanding some code somewhere.
The full error is:
Build failed.
File: assets/vendor.js (95443:4)
The Broccoli Plugin: [UglifyWriter] failed with:
Error
at new JS_Parse_Error (eval at (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), :1545:18)
at js_error (eval at <anonymous> (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:1553:11)
at croak (eval at <anonymous> (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2092:9)
at token_error (eval at <anonymous> (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2100:9)
at unexpected (eval at <anonymous> (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2106:9)
at semicolon (eval at <anonymous> (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2126:56)
at simple_statement (eval at <anonymous> (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2317:73)
at eval (eval at <anonymous> (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2186:19)
at eval (eval at <anonymous> (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2139:24)
at block_ (eval at <anonymous> (/home/larisoft/frontend/node_modules/uglify-js/tools/node.js:1:1), <anonymous>:2432:20)
The broccoli plugin was instantiated at:
at UglifyWriter.Plugin (/home/larisoft/frontend/node_modules/broccoli-plugin/index.js:7:31)
at new UglifyWriter (/home/larisoft/frontend/node_modules/broccoli-uglify-sourcemap/index.js:25:10)
at UglifyWriter (/home/larisoft/frontend/node_modules/broccoli-uglify-sourcemap/index.js:20:12)
at Class.postprocessTree (/home/larisoft/frontend/node_modules/ember-cli-uglify/index.js:15:50)
at /usr/local/lib/node_modules/ember-cli/lib/broccoli/ember-app.js:543:27
at Array.forEach (native)
at EmberApp.addonPostprocessTree (/usr/local/lib/node_modules/ember-cli/lib/broccoli/ember-app.js:541:23)
at EmberApp.toTree (/usr/local/lib/node_modules/ember-cli/lib/broccoli/ember-app.js:1667:15)
at module.exports (/home/larisoft/frontend/ember-cli-build.js:37:16)
at Class.setupBroccoliBuilder (/usr/local/lib/node_modules/ember-cli/lib/models/builder.js:70:19)
my package.json
{
"name": "hospitalrun",
"version": "0.9.12",
"description": "Ember front end for HospitalRun",
"homepage": "http://curacel.co",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "./script/build",
"start": "./script/server",
"test": "snyk test && ./script/test"
},
"repository": {
"type": "git",
"url": "git#github.com:HospitalRun/hospitalrun-frontend"
},
"engines": {
"node": ">= 0.10.0"
},
"author": "John Kleinschmidt",
"contributors": [
"Joel Worrall",
"Joel Glovier"
],
"license": "GPL-3.0",
"devDependencies": {
"body-parser": "^1.14.2",
"broccoli-asset-rev": "^2.4.1",
"broccoli-export-text": "0.0.2",
"broccoli-funnel": "^1.0.1",
"broccoli-manifest": "0.0.7",
"broccoli-merge-trees": "^1.0.0",
"broccoli-serviceworker": "0.1.0",
"ember-ajax": "2.3.2",
"ember-cli": "^2.4.1",
"ember-cli-active-link-wrapper": "0.2.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-content-security-policy": "0.5.0",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-deprecation-workflow": "0.2.2",
"ember-cli-fake-server": "0.3.1",
"ember-cli-htmlbars": "^1.0.7",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^2.0.0",
"ember-cli-release": "1.0.0-beta.1",
"ember-cli-sass": "^5.2.1",
"ember-cli-scss-lint": "1.0.0",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-data": "^2.4.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-font-awesome": "2.1.1",
"ember-i18n": "4.2.1",
"ember-load-initializers": "^0.5.0",
"ember-pouch": "^3.1.0",
"ember-rapid-forms": "1.0.0-beta4",
"ember-resolver": "^2.0.3",
"ember-select-list": "0.9.5",
"ember-simple-auth": "^1.1.0-beta.3",
"ember-simple-auth-registration": "1.0.2",
"ember-suave": "2.0.1",
"ember-truth-helpers": "1.2.0",
"ember-validations": "2.0.0-alpha.4",
"express": "^4.8.5",
"glob": "^7.0.0",
"hospitalrun-dblisteners": "0.9.2",
"hospitalrun-server-routes": "0.9.7",
"loader.js": "^4.0.7",
"nano": "6.2.0",
"request": "2.72.0"
},
"dependencies": {
"ember-cli-babel": "^5.1.5",
"ember-cli-uglify": "^1.2.0",
"ember-radio-buttons": "^4.0.1",
"ember-resolver": "^2.1.0",
"snyk": "^1.14.1",
"sw-toolbox": "^3.1.1",
"uglify-js": "^2.7.4"
},
"ember-addon": {
"paths": [
"lib/pouch-fixtures"
]
}
}
My ember-cli-build:
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
// Add options here
});
// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
app.import('vendor/pouchdb-list/pouchdb-list.js');
app.import('bower_components/node-uuid/uuid.js');
app.import('bower_components/bootstrap/dist/js/bootstrap.js');
app.import('bower_components/JsBarcode/CODE128.js');
app.import('bower_components/JsBarcode/JsBarcode.js');
app.import('vendor/dymo/DYMO.Label.Framework.1.2.6.js');
app.import('bower_components/moment/moment.js');
app.import('bower_components/typeahead.js/dist/typeahead.bundle.js');
app.import('bower_components/pikaday/pikaday.js');
app.import('bower_components/filer.js/src/filer.js');
app.import('bower_components/idb.filesystem/src/idb.filesystem.js');
app.import('bower_components/pikaday/css/pikaday.css');
app.import('vendor/octicons/octicons/octicons.css');
app.import('bower_components/pouchdb-load/dist/pouchdb.load.js');
app.import('bower_components/pouchdb/dist/pouchdb.memory.js');
return app.toTree();
};
It seems like uglify.js has some problems with ES6 files: https://forum.ionicframework.com/t/uglifyjs-fails-with-js-parse-error-error-but-no-stack-trace/66094. In my case it was enough to downgrade one library (fold-to-ascii) to an ES5 version.
Unfortunately, an error message isn't very helpful, so finding the problematic file is unnecessarily difficult. It's hard to tell which file causes the error in Your case, but I can at least say what helped me.
I manually put a log (with help from http://discuss.emberjs.com/t/debugging-failures-in-uglifyjs/7390/6):
function js_error(message, filename, line, col, pos) {
console.log(`message: ${message} / filename: ${filename} / line: ${line}`);
throw new JS_Parse_Error(message, filename, line, col, pos);
};
into js_error function of node_modules/uglify-js/lib/parse.js (line 205 in my case), and got a message that was actually helpful:
message: SyntaxError: Unexpected token: name (ASCIIFolder) / file: 0 / line: 64911 / position: 2070881
Then, with the find in path search on text "ASCIIFolder", I was able to locate the problematic files.
Also it may be necessary to do 'clean' install of npm and bower packages (https://emberigniter.com/update-latest-ember-data-cli/):
npm cache clean && bower cache clean
rm -rf node_modules bower_components dist tmp
npm install
bower install
Alternatively You can completely disable minifying of vendor.js with [https://ember-cli.com/asset-compilation#exclude-from-minification] (although it's not the greatest solution):
// ember-cli-build.js
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
minifyJS: {
options: {
exclude: ["**/vendor.js"]
}
}
});
//...
return app.toTree();
};
which tells broccoli-uglify-sourcemap to ignore vendor.js and, therefore, should prevent an error from happening.
UPDATE:
If you are not supporting IE9 browsers then you can use ember-cli-uglify#2.0.0 stable release for minification.
uglifyjs has problem in minifying the newer ES features, you can use ember-cli-babili to minify the javascript babili in Ember-CLI.
npm uninstall --save-dev ember-cli-uglify
npm install --save-dev ember-cli-babili
I am using it my app. It's mentioned by RWJBlue in his blog(http://rwjblue.com/2017/04/21/ember-cli-targets/)
I was tired of such errors, so I replaced uglify-js with upglify-es.
Using yarn and ember-cli:
yarn upgrade ember-cli-uglify#2.0.0-beta.1
In my case I got:
Build Error (UglifyWriter)
Unexpected token: eof (undefined)
The solution was to update ember-cli-moment-shim to version v3.8.0