diff --git a/openecomp-ui/tools/gulp/deployment/gulpfile.js b/openecomp-ui/tools/gulp/deployment/gulpfile.js
new file mode 100644
index 0000000..9938910
--- /dev/null
+++ b/openecomp-ui/tools/gulp/deployment/gulpfile.js
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+var gulp = require('gulp');
+var i18nUpdateTask = require('./tools/gulp/tasks/i18nUpdate');
+
+gulp.task('i18nUpdate', function() {
+
+	return i18nUpdateTask({
+		warDir: process.cwd(),
+		lang: 'en'
+	});
+});
+
+gulp.task('default', ['i18nUpdate']);
+
diff --git a/openecomp-ui/tools/gulp/deployment/package.json b/openecomp-ui/tools/gulp/deployment/package.json
new file mode 100644
index 0000000..3bad037
--- /dev/null
+++ b/openecomp-ui/tools/gulp/deployment/package.json
@@ -0,0 +1,23 @@
+{
+  "name": "sdc-client-tools",
+  "version": "9.3.0",
+  "description": "Service Designer & Catalog Client Tools",
+  "dependencies": {},
+  "devDependencies": {
+    "bluebird": "^2.10.1",
+    "gulp": "^3.9.0",
+    "gulp-rename": "^1.2.2",
+    "gulp-replace": "^0.5.4",
+    "prompt": "^0.2.14"
+  },
+  "author": "ECOMP",
+  "license": "LicenseRef-LICENSE",
+  "scripts": {
+    "start": "gulp run",
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "engines": {
+    "node": ">=0.12.7",
+    "npm": ">=2.11.3"
+  }
+}
diff --git a/openecomp-ui/tools/gulp/deployment/tools/gulp/tasks/i18nUpdate.js b/openecomp-ui/tools/gulp/deployment/tools/gulp/tasks/i18nUpdate.js
new file mode 100644
index 0000000..a3cae5b
--- /dev/null
+++ b/openecomp-ui/tools/gulp/deployment/tools/gulp/tasks/i18nUpdate.js
@@ -0,0 +1,171 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+var gulp, replace, rename, fs, prompt, Promise;
+
+function mergePromptOptions(options) {
+
+	return new Promise(function(resolve, reject) {
+		var lang = options.lang;
+		var warDir = options.warDir;
+		prompt.start();
+		prompt.get([
+			{
+				description: 'Enter war directory',
+				default: warDir,
+				name: 'warDir'
+			},
+			{
+				description: 'Enter locale.json parent directory name',
+				default: lang,
+				name: 'lang'
+			}
+		], function (err, result) {
+
+			if(err) {
+				reject(new Error('mergePromptOptions::>\n    ' + err));
+				return;
+			}
+
+			var warDir = result.warDir;
+			var lang = result.lang;
+
+			console.log('\nlocale.json parent directory name> "' + lang + '"');
+			console.log('war director>"' + warDir + '"');
+
+			resolve({
+				warDir: warDir,
+				lang: lang
+			});
+		});
+	});
+}
+
+function isBundleExists(path) {
+	return new Promise(function(resolve) {
+		fs.stat(path, function(err) {
+			resolve(null == err);
+			/*if null == err then file exists.*/
+		});
+	});
+}
+
+function copyEnglishBundle(enBundlePath, lang) {
+	return new Promise(function(resolve, reject) {
+		gulp.src(enBundlePath, {base: './'})
+			.pipe(rename({basename: 'bundle_' + lang}))
+			.pipe(gulp.dest('./'))
+			.on('end', function() {
+				resolve();
+			})
+			.on('error', function(err) {
+				reject(new Error('copyEnglishBundle::>\n    ' + err));
+			});
+	});
+}
+
+function getLocaleContent(localePath) {
+
+	return new Promise(function(resolve, reject) {
+		fs.readFile(localePath, {encoding: 'utf-8'}, function(err,data){
+			if(err) {
+				reject('getLocaleContent()::>\n    ' + err);
+				return;
+			}
+			resolve(data);
+		});
+	});
+
+}
+
+function extractLocaleJsonContent(localeDataStr) {
+
+	var localeJsonStrI18nStartIdx = localeDataStr.indexOf('I18N_IDENTIFIER_START');
+	var localeJsonStrI18nEndIdx = localeDataStr.indexOf('I18N_IDENTIFIER_END');
+
+	if(-1 === localeJsonStrI18nStartIdx || -1 === localeJsonStrI18nEndIdx) {
+		return Promise.reject(new Error('extractLocaleJsonContent::> localeDataStr must contain %I18N_IDENTIFIER_START% and %I18N_IDENTIFIER_END%'));
+	}
+
+	var localeJsonStr = localeDataStr.substring(
+		localeDataStr.indexOf('{', localeJsonStrI18nStartIdx),
+		localeDataStr.lastIndexOf('}', localeJsonStrI18nEndIdx) + 1
+	);
+
+	try {
+		JSON.parse(localeJsonStr);
+	} catch(e) {
+		return Promise.reject(new Error('extractLocaleJsonContent::> localeDataStr must contain a valid json between %I18N_IDENTIFIER_START% and %I18N_IDENTIFIER_END%=>' + e));
+	}
+
+	return Promise.resolve(localeJsonStr);
+}
+
+function setBundleLocaleContent(bundlePath, localeJsonStr) {
+	return new Promise(function(resolve, reject) {
+		gulp.src(bundlePath, {base: './'})
+			.pipe(replace(/I18N_IDENTIFIER_START(.|[\r\n])*?I18N_IDENTIFIER_END/i, function(expr) {
+				return expr.substring(0, expr.indexOf('{')) + localeJsonStr + expr.substring(expr.lastIndexOf('}') + 1);
+			}))
+			.pipe(gulp.dest('./'))
+			.on('end', function() {
+				resolve();
+			})
+			.on('error', function(err) {
+				reject(new Error('setBundleLocaleContent::>\n    ' + err));
+			});
+	});
+}
+
+
+function update(options) {
+
+	gulp = require('gulp');
+	replace = require('gulp-replace');
+	rename = require('gulp-rename');
+	fs = require('fs');
+	prompt = require('prompt');
+	Promise = require('bluebird');
+
+	return mergePromptOptions(options).then(function(mergedOptions) {
+		var lang = mergedOptions.lang;
+		var warDir = mergedOptions.warDir;
+
+		var bundlePath = warDir + '/js/bundle_' + lang + '.js';
+		var localePath = warDir + '/i18n/' + lang + '/locale.json';
+
+		return isBundleExists(bundlePath)
+			.then(function(isBundleExist) {
+				var englishBundlePath;
+				if(!isBundleExist) {
+					englishBundlePath = warDir + '/js/bundle_en.js';
+					return copyEnglishBundle(englishBundlePath, lang);
+				}
+			})
+			.then(getLocaleContent.bind(null, localePath))
+			.then(extractLocaleJsonContent)
+			.then(setBundleLocaleContent.bind(null, bundlePath));
+	});
+
+}
+
+
+
+module.exports = update;
diff --git a/openecomp-ui/tools/gulp/tasks/i18n.js b/openecomp-ui/tools/gulp/tasks/i18n.js
new file mode 100644
index 0000000..38b2a02
--- /dev/null
+++ b/openecomp-ui/tools/gulp/tasks/i18n.js
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+var gulp = require('gulp');
+var fs = require('fs');
+var replace = require('gulp-replace');
+var clean = require('gulp-clean');
+var mkdirp = require('mkdirp');
+
+/**
+ *
+ * @param options.outputPath
+ * @param options.localesPath
+ * @param options.lang = options.lang
+ *
+ * @returns {string}
+ */
+function composeLocalesDirPath(options) {
+	return options.outputPath + options.localesPath + options.lang;
+}
+
+/**
+ *
+ * @param options.outputPath
+ * @param options.localesPath
+ * @param options.lang
+ *
+ * @returns {string}
+ */
+function composeLocaleFilePath(options) {
+	return composeLocalesDirPath(options) + '/locale.json';
+}
+
+
+/**
+ * @param options
+ * @param options.outputPath
+ * @param options.localesPath
+ * @param options.lang = options.lang
+ *
+ */
+function ensureLocalesDir(options) {
+
+	return new Promise(function (resolve, reject) {
+		mkdirp(composeLocalesDirPath(options), function (err) {
+			if (err) {
+				reject(err);
+			}
+			else {
+				resolve();
+			}
+		});
+	});
+
+}
+
+/**
+ *
+ * @param options
+ * @param options.outputPath
+ * @param options.localesPath
+ * @param options.lang = options.lang
+ *
+ */
+function i18nTask(options) {
+
+	var i18nJson = {};
+
+	function addWord(expr) {
+		var word = expr.substring('i18n(\''.length, expr.length - 1);
+		i18nJson[word] = word;
+		return expr;
+	}
+
+	return ensureLocalesDir(options).then(function () {
+		return new Promise(function(resolve, reject) {
+			gulp.src(options.outputPath + '**/*.js', {base: './'})
+				.pipe(replace(/i18n\('.*?'/g, addWord))
+				.pipe(clean())
+				.pipe(gulp.dest('./'))
+				.on('end', function () {
+
+					var i18nJsonWrapper = { dataWrapperArr: ["I18N_IDENTIFIER_START", i18nJson, "I18N_IDENTIFIER_END"] , i18nDataIdx: 1};
+
+					fs.writeFile(composeLocaleFilePath(options), JSON.stringify(i18nJsonWrapper), function (err) {
+						if (err) {
+							reject(err);
+						}
+						else resolve();
+					});
+				}).on('error', function (err) {
+					reject(err);
+				});
+		});
+	});
+}
+
+module.exports = i18nTask;
diff --git a/openecomp-ui/tools/gulp/tasks/prod.js b/openecomp-ui/tools/gulp/tasks/prod.js
new file mode 100644
index 0000000..d66b841
--- /dev/null
+++ b/openecomp-ui/tools/gulp/tasks/prod.js
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+var gulp, replace, Promise, webpack, webpackProductionConfig;
+
+var supportedLanguages = ['en'];
+
+function start(options) {
+
+	var promises = [buildIndex(options)];
+	supportedLanguages.forEach(function (lang) {
+		promises.push(bundleJS(options, lang));
+	});
+	return Promise.all(promises);
+}
+
+function bundleJS(options, lang) {
+	return new Promise(function (resolve, reject) {
+		var prodConfig = webpackProductionConfig;
+		prodConfig.resolve.alias.i18nJson = options.outDir + '/i18n/' + lang + '/locale.json';
+		prodConfig.output.filename = jsFileByLang(options.outFileName, lang);
+		webpack(prodConfig, function (err, stats) {
+			console.log('[webpack:build]', stats.toString());
+			if (err || stats.hasErrors()) {
+				console.log('bundleJS : Failure!!', '\n		-language: ', lang);
+				reject(err || stats.toJson().errors);
+			}
+			else {
+				console.log('bundleJS : Done', '\n		-language: ', lang);
+				resolve();
+			}
+		});
+	});
+}
+
+function buildIndex(options) {
+
+	return new Promise(function (resolve, reject) {
+
+		var stream = gulp.src(options.outDir + '/index.html');
+
+		stream.pipe(replace(/\/\/<!--prod:delete-->(.|[\r\n])*?<!--\/prod:delete-->/g, ''))//in script occurrences.
+			.pipe(replace(/<!--prod:delete-->(.|[\r\n])*?<!--\/prod:delete-->/g, ''))//out of script occurrences.
+			.pipe(replace(/<!--prod:add(-->)?/g, ''))
+			.pipe(replace(/\/\/<!--prod:supported-langs-->(.|[\r\n])*?<!--\/prod:supported-langs-->/g, supportedLanguages.map(function (val) {
+				return "'" + val + "'";
+			}).toString()))
+			.pipe(gulp.dest(options.outDir))
+			.on('end', function () {
+				console.log('buildIndex : Done');
+				resolve();
+			})
+			.on('error', function (e) {
+				console.log('buildIndex : Failure!!');
+				reject(e);
+			});
+	});
+
+}
+
+function jsFileByLang(fileName, lang) {
+	return fileName.replace(/.js$/, '_' + lang + '.js');
+}
+
+/**
+ * @param options
+ * @param options.outFileName optional <default build>
+ */
+function prodTask(options) {
+
+	gulp = require('gulp');
+	replace = require('gulp-replace');
+	Promise = require('bluebird');
+	webpack = require('webpack');
+	webpackProductionConfig = options.webpackProductionConfig;
+
+	return start({
+		outFileName: options.outFileName || '[name].js',
+		outDir: options.outDir
+	});
+}
+
+module.exports = prodTask;
