Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dhcp interface #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private Collection<? extends Network> convert(JSONArray dhcpconfigs, Endpoint en
dhcpconfigs.forEach(c -> {
DHCPConfig c1 = JSONObject.parseObject(c.toString(), DHCPConfig.class);
Network network = new Network();
network.setInterFace(c1.getinterFace());
network.setStartIp(c1.getStartIp());
network.setEndIp(c1.getEndIp());
network.setNetmask(c1.getNetmask());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Objects;

public class DHCPConfig {
private String interFace;
private String startIp;
private String endIp;
private String netmask;
Expand All @@ -26,7 +27,13 @@ public String getNetSegment() {
public String getStartIp() {
return startIp;
}
public String getinterFace() {
return interFace;
}

public void setinterFace(String interFace) {
this.interFace = interFace;
}
public void setStartIp(String startIp) {
this.startIp = startIp;
}
Expand Down Expand Up @@ -69,6 +76,7 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
DHCPConfig config = (DHCPConfig) o;
return pxeEnabled == config.pxeEnabled &&
Objects.equals(interFace,config.interFace) &&
Objects.equals(startIp, config.startIp) &&
Objects.equals(endIp, config.endIp) &&
Objects.equals(netmask, config.netmask) &&
Expand All @@ -77,6 +85,6 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(startIp, endIp, netmask, gateway, pxeEnabled);
return Objects.hash(interFace,startIp, endIp, netmask, gateway, pxeEnabled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class Network implements Serializable {
private String name;

private String vlanId;

private String interFace;

private String startIp;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<result column="endpoint_id" jdbcType="VARCHAR" property="endpointId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="vlan_id" jdbcType="VARCHAR" property="vlanId" />
<result column="interFace" jdbcType="VARCHAR" property="interFace" />
<result column="start_ip" jdbcType="VARCHAR" property="startIp" />
<result column="end_ip" jdbcType="VARCHAR" property="endIp" />
<result column="netmask" jdbcType="VARCHAR" property="netmask" />
Expand Down Expand Up @@ -72,7 +73,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, endpoint_id, name, vlan_id, start_ip, end_ip, netmask, dhcp_enable, pxe_enable,
id, endpoint_id, name, vlan_id,interFace,start_ip, end_ip, netmask, dhcp_enable, pxe_enable,
create_time
</sql>
<select id="selectByExample" parameterType="io.rackshift.mybatis.domain.NetworkExample" resultMap="BaseResultMap">
Expand Down Expand Up @@ -106,7 +107,7 @@
</if>
</delete>
<insert id="insert" parameterType="io.rackshift.mybatis.domain.Network">
insert into network (id, endpoint_id, name,
insert into network (id, endpoint_id, name, interFace,
vlan_id, start_ip, end_ip,
netmask, dhcp_enable, pxe_enable,
create_time)
Expand All @@ -130,6 +131,9 @@
<if test="vlanId != null">
vlan_id,
</if>
<if test="interFace != null">
interFace,
</if
<if test="startIp != null">
start_ip,
</if>
Expand Down Expand Up @@ -162,6 +166,9 @@
<if test="vlanId != null">
#{vlanId,jdbcType=VARCHAR},
</if>
<if test="interFace != null">
#{interFace,jdbcType=VARCHAR},
</if
<if test="startIp != null">
#{startIp,jdbcType=VARCHAR},
</if>
Expand Down Expand Up @@ -203,6 +210,9 @@
<if test="record.vlanId != null">
vlan_id = #{record.vlanId,jdbcType=VARCHAR},
</if>
<if test="record.interFace != null">
interFace = #{record.interFace,jdbcType=VARCHAR},
</if
<if test="record.startIp != null">
start_ip = #{record.startIp,jdbcType=VARCHAR},
</if>
Expand Down Expand Up @@ -232,6 +242,7 @@
endpoint_id = #{record.endpointId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
vlan_id = #{record.vlanId,jdbcType=VARCHAR},
interFace = #{record.interFace,jdbcType=VARCHAR},
start_ip = #{record.startIp,jdbcType=VARCHAR},
end_ip = #{record.endIp,jdbcType=VARCHAR},
netmask = #{record.netmask,jdbcType=VARCHAR},
Expand All @@ -254,6 +265,9 @@
<if test="vlanId != null">
vlan_id = #{vlanId,jdbcType=VARCHAR},
</if>
<if test="interFace != null">
interFace = #{interFace,jdbcType=VARCHAR},
</if
<if test="startIp != null">
start_ip = #{startIp,jdbcType=VARCHAR},
</if>
Expand All @@ -280,6 +294,7 @@
set endpoint_id = #{endpointId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
vlan_id = #{vlanId,jdbcType=VARCHAR},
interFace = #{interFace,jdbcType=VARCHAR},
start_ip = #{startIp,jdbcType=VARCHAR},
end_ip = #{endIp,jdbcType=VARCHAR},
netmask = #{netmask,jdbcType=VARCHAR},
Expand Down
7 changes: 6 additions & 1 deletion rackshift-web/src/common/validator/CommonValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ function ipValidator(rule, value, callback) {
}
callback();
}

function interfaceValidator(rule,value,callback) {
if (value === '' || !value ) {
callback(new Error(rule.vue.$t('cannt_be_null')))
}
callback()
}
function vlanValidator(rule, value, callback) {
if (rule.require) {
if (value === '' || !value || value.length === 0) {
Expand Down
9 changes: 8 additions & 1 deletion rackshift-web/src/components/network/Network.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@
</el-option>
</el-select>
</el-form-item>

<el-form-item :label="$t('interFace')" prop="pxe网卡名称">
<el-input v-model="editObj.interFace" autocomplete="off"
:placeholder="$t('pls_input_interface')"></el-input>
</el-form-item>
<el-form-item :label="$t('startIp')" prop="startIp">
<el-input v-model="editObj.startIp" autocomplete="off"
:placeholder="$t('pls_input_start_ip')"></el-input>
Expand Down Expand Up @@ -151,6 +154,7 @@
import HttpUtil from "../../common/utils/HttpUtil"
import {
ipValidator,
interfaceValidator,
requiredSelectValidator,
maskValidator,
requiredValidator
Expand All @@ -169,6 +173,9 @@ export default {
endpointId: [
{validator: requiredSelectValidator, trigger: 'blur', vue: this},
],
interFace: [
{validator: interfaceValidator, trigger: 'blur', vue: this},
],
startIp: [
{validator: ipValidator, trigger: 'blur', vue: this},
],
Expand Down
2 changes: 2 additions & 0 deletions rackshift-web/src/i18n/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export default {
"network_card": "Network Card",
"endpoint": "Node",
"pls_select_bare_metal": "Please select a bare metal server",
"interFace": "PXE interface name",
"start_ip": "Start IP",
"edit_execution_log": "Edit deployment log",
"pls_input_interface": "please enter you pxe interface name",
"pls_input_start_ip": "Please enter the start ip",
"disabled": "No",
"sn": "Serial Number",
Expand Down
2 changes: 2 additions & 0 deletions rackshift-web/src/i18n/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default {
"pls_select_bare_metal": "请选择将执行工作流的服务器",
"start_ip": "起始 IP",
"edit_execution_log": "编辑部署日志",
"pls_input_interface": "请输入pxe网卡名称",
"pls_input_start_ip": "请输入开始ip",
"disabled": "否",
"sn": "序列号",
Expand Down Expand Up @@ -235,6 +236,7 @@ export default {
"proc_name": "处理器型号",
"no_nessary_to_set": "无参数设置",
"raid": "RAID级别",
"interFace": "PXE网卡名称",
"startIp": "开始 IP",
"User": "用户",
"enclosure_id": "EnclosureId",
Expand Down
2 changes: 2 additions & 0 deletions rackshift-web/src/i18n/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export default {
"network_card": "網卡",
"endpoint": "代理節點",
"pls_select_bare_metal": "請選擇將執行工作流的裸金屬服務器",
"interFace": "PXE網卡名稱",
"start_ip": "起始 IP",
"edit_execution_log": "編輯部署日誌",
"pls_input_interface": "請輸入pxe網卡名稱",
"pls_input_start_ip": "請輸入開始ip",
"disabled": "否",
"sn": "序列號",
Expand Down